\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Gray00} \pdfinfo{ /Title (calcolatori-elettronici.pdf) /Creator (Cheatography) /Author (Gray00) /Subject (Calcolatori Elettronici Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{FA854B} \definecolor{LightBackground}{HTML}{FEF7F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Calcolatori Elettronici Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Gray00} via \textcolor{DarkBackground}{\uline{cheatography.com/146241/cs/31609/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Gray00 \\ \uline{cheatography.com/gray00} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 7th June, 2022.\\ Updated 27th June, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Semafori}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{`sem\_wait(sem);`} \{\{nobreak\}\} & Esegue `counter-{}-` e nel caso aggiunge a waiting il processo. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `sem\_signal(sem);`\{\{nobreak\}\} & Rilascia un gettone. Esegue `counter++` ed estrae dalla lista dei waiting. \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} `sem\_ini(\$gettoni);`\{\{nobreak\}\} & Restituisce il primo semaforo libero inserendovi \$gettoni gettoni. 0xFFFFFFFF se qualcosa è andato storto. \tn % Row Count 12 (+ 5) % Row 3 \SetRowColor{white} `sem\_valid(id);`\{\{nobreak\}\} & Verifica la validità di un semaforo. \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Mutex: \$gettone = 1 \newline Sync: \$gettone = 0 \newline Nota: tutti gli errori sono 0xFFFFFFFF \newline Attenzione: Tutti gli id sono `natl`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Processi}} \tn % Row 0 \SetRowColor{LightBackground} `des\_p(id);`\{\{nobreak\}\}\{\{bl\}\} & Restituisce un des\_proc* a partire dall'id. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `c\_abort\_p();`\{\{nobreak\}\} & Porta all'interruzione del processo. Non effettua return ed è utile nei casi di errore. \tn % Row Count 8 (+ 5) % Row 2 \SetRowColor{LightBackground} `p-\textgreater{}contesto{[}{\bf{I\_RAX}}{]} = \$value;`\{\{bl\}\} & Ritorno della funzione di value. \tn % Row Count 10 (+ 2) % Row 3 \SetRowColor{white} `rimozione\_lista(\$lista);`\{\{nobreak\}\} & Rimuove la testa dalla lista (max prio) \tn % Row Count 12 (+ 2) % Row 4 \SetRowColor{LightBackground} `inspronti();`\{\{nobreak\}\} & Inserisce {\bf{esecuzione}} in testa a pronti \tn % Row Count 15 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Tutti gli `id` sono `natl`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preemption}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{des\_proc* work = \seqsplit{rimozione\_lista(\$lista);} \newline inspronti(); \newline inserimento\_lista(pronti, work); \newline schedulatore();} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Alla fine ci sarà sicuramente uno tra il processo in esecuzione e work attivo} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Utilità}} \tn % Row 0 \SetRowColor{LightBackground} flog(MODE, "msg"); & Mostra a schermo il messaggio msg \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{LOG\_DEBUG: costante per debug \newline LOG\_INFO: costante per informazioni \newline LOG\_WARN: costante per avviso} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Tab iter}} \tn % Row 0 \SetRowColor{LightBackground} `tab\_iter it(tab, begin, dim);`\{\{bl\}\} & Utile per scorrere le entrate dell'albero degli indirizzi \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `it.down();`\{\{nobreak\}\} & Per scorrere in profondità, vedi vm.h \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} `it.is\_leaf();`\{\{nobreak\}\} & restituisce `true` se è una foglia \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} `tab\_entry\& e = it.get\_e();`\{\{nobreak\}\} & Restituisce un riferimento al descrittore corrente \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} `vaddr v = it.get\_v();`\{\{nobreak\}\} & Restituisce l'indirizzo virtuale asdsociato alla entry in it \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} `paddr p = \seqsplit{extr\_IND\_FISICO(\$e);`} & Restituisce l'indirizzo fisico associato alla entry \tn % Row Count 16 (+ 3) % Row 6 \SetRowColor{LightBackground} \seqsplit{`set\_IND\_FISICO(\$e}, \$paddr);` & Setta l'indirizzo fisico corrispondente alla entry \$e \tn % Row Count 19 (+ 3) % Row 7 \SetRowColor{white} `alloca\_tab();` & Alloca un frame libero destinato a contenere una tabella di traduzione restituendo l'indirizzo del frame \tn % Row Count 25 (+ 6) % Row 8 \SetRowColor{LightBackground} `copy\_des(paddr src, paddr dst, natl i, natl n);` & Copia 'n' descrittori da src in dst a partire dall'indice i \tn % Row Count 28 (+ 3) % Row 9 \SetRowColor{white} `set\_des(paddr dst, natl i, natl n, tab\_entry e);` & Setta il valore 'e' su 'n' descrittori a partire dall'indice 'i' \tn % Row Count 32 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Utilizzo tab\_iter}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{for (tab\_iter it(p-\textgreater{}cr3, ini\_utn\_p, dim); it; it.next()) \{ \newline if (!it.is\_leaf()) \newline continue; \newline \newline tab\_entry\& e = it.get\_e(); \newline vaddr v = it.get\_v(); \newline paddr p = extr\_IND\_FISICO(e); // or set \newline /{\emph{ e \&= \textasciitilde{}BIT\_RW; \newline abbiamo modificato RW: invalidamo \newline le entrate nel TLB \newline invalida\_entrata\_TLB(v);}}/ \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Memoria Virtuale}} \tn % Row 0 \SetRowColor{LightBackground} `trasforma(vaddr);`\{\{nobreak\}\}\{\{bl\}\} & Restituisce il paddr relativo a un vaddr \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `tipo\_livello\_accesso`\{\{nobreak\}\} & Vedere le note \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} `alloca\_frame();`\{\{nobreak\}\} & restituisce l'indirizzo del frame caricato \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} `rilascia\_frame(\$paddr);`\{\{nobreak\}\} & Libera il frame in cui è contenuto \$paddr \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} `paddr base = p \& \textasciitilde{}0xFFF;`\{\{nobreak\}\} & base di un frame \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} `natl indice = p / DIM\_PAGINA;`\{\{nobreak\}\} & Indice di frame \tn % Row Count 15 (+ 3) % Row 6 \SetRowColor{LightBackground} `invalida\_entrata\_TLB(\$vaddr);`\{\{bl\}\} & Invalida l'entrata del TLB del processo in esecuzione \tn % Row Count 18 (+ 3) % Row 7 \SetRowColor{white} cr0 & Abilita la paginazione \tn % Row Count 20 (+ 2) % Row 8 \SetRowColor{LightBackground} cr1 & Non implementato \tn % Row Count 21 (+ 1) % Row 9 \SetRowColor{white} cr2 & Indirizzo che ha causato page fault \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} cr3 & paddr albero di traduzione del processo \tn % Row Count 25 (+ 2) % Row 11 \SetRowColor{white} vdf{[}{]}; & array dei descrittori di frame \tn % Row Count 27 (+ 2) % Row 12 \SetRowColor{LightBackground} `memcpy( (void{\emph{) dst, (void}}) src, int nbytes);`\{\{bl\}\} & copia da dst a src nbytes \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Memoria Virtuale (cont)}} \tn % Row 13 \SetRowColor{LightBackground} `map(p-\textgreater{}cr3, vaddr begin, vaddr end, FLAGS, putpaddr);` & Mappa gli indirizzi fisici passati da putpaddr nell'intervallo {[}begin, end) restituendo il primo che non è riuscito a tradurre \tn % Row Count 7 (+ 7) % Row 14 \SetRowColor{white} `unmap(p-\textgreater{}cr3, vaddr begin, vaddr end, getpaddr);` & Rimuove le traduzioni nell'intervallo {[}begin, end) da p-\textgreater{}cr3 \tn % Row Count 10 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{- {\bf{tipo}}: ini, fin \newline - {\bf{livello}}: utn, sis \newline - {\bf{accesso}}: p, c \newline {\bf{Livello tabelle}}: 4, 3, 2, 1 \newline {\bf{FLAGS}}: bit\_RW, bit\_US} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{column break}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Funtore}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{class Funtore\{ \newline public: \newline paddr pa{[}DIM\_PAGINA{]}; \newline natl i; \newline \newline // init di i a 0 \newline Funtore() : i(0) \{\} \newline \newline // per la {\bf{map}} \newline paddr operator()(vaddr v)\{ \newline return pa{[}i++{]}; \newline \} \newline \newline // per la {\bf{unmap}} \newline void operator()(vaddr, paddr p, int)\{ \newline pa{[}i++{]} = p; \newline // oppure trasforma(v); \newline \} \newline \}; {\emph{// attento a {\bf{;}} !!!}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Elimina da lista}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{des\_proc{\emph{ elimina\_da\_lista(des\_proc}}\& testa, des\_proc{\emph{ p)\{}} \newline des\_proc {\bf{prec = \&testa, }}scorri = testa; \newline while (scorri \&\& scorri != p) \{ \newline prec = \&scorri-\textgreater{}puntatore; \newline scorri = scorri-\textgreater{}puntatore; \newline \} \newline if (scorri) \newline {\emph{prec = scorri-\textgreater{}puntatore; \newline \newline return scorri; \newline }}\}}}*} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Rimuove dalla lista puntata da `\$testa` il `des\_proc* p`.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{page break}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{I/O}} \tn % Row 0 \SetRowColor{LightBackground} `access(vaddr b, natq dim, bool w, bool s);` & Controlla il {\bf{cavallo di Troia}} per w(ritable) e s(hared) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `z = input{\bf{x}}(reg);` & Inserisce il valore al registro reg in z \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} `output{\bf{x}}(value, reg);` & Inserisce nel registro reg il valore value \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} `des\_x y = new({\bf{align\_val\_t\{dim\}}}) des\_x;` & Allinea il nuovo valore in memoria \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} `natl spostabili = DIM\_PAGINA - (paddr \& 0xFFF);` & Calcola il numero di byte spostabili per esaurire il frame \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{x: {\bf{b}}(yte), {\bf{l}}(ong), {\bf{q}}(uad)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Approccio I/O}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{- Quando viene chiamata l'interruzione? \newline % Row Count 1 (+ 1) - Chi prepara il descrittore? \newline % Row Count 2 (+ 1) - Cosa deve fare l'interruzione? \newline % Row Count 3 (+ 1) - Come rispondiamo all'interruzione? \newline % Row Count 4 (+ 1) - Come ci prepariamo alla prossima interruzione? \newline % Row Count 5 (+ 1) {\bf{{\emph{Nota}}}}: {\emph{nei casi, perlomeno di lettura, potrebbe essere sensato impostare i valori passati come parametri dalla primitiva all'interno del descrittore. Sarà poi l'interruzione (se chiamata ogni tot) a sistemare questi valori già inizializzati con i valori aggiornati. Se invece dovesse essere richiamata solo alla fine del processo, sarà compito della read fare tutto il processo e abilitare le interruzioni alla fine facendo riattivare la estern\_ce}} \newline % Row Count 15 (+ 10) {\bf{{\emph{Nota2}}}}: {\emph{quando in una read viene passato un buffer, questo dovrà essere copiato nel descrittore in quanto è il buffer in cui la periferica dovrà scrivere i valori che dovremo leggere.}} \newline % Row Count 19 (+ 4) {\bf{{\emph{Nota3}}}}: {\emph{se il passaggio di byte tra utente e periferica viene effettuato tramite un buffer di appoggio intermedio, dobbiamo necessariamente usare la memcpy, in quanto questi dati devono essere copiati in una zona di memoria.}}% Row Count 24 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Estern CE}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// chiamata dalla periferica con un'interruzione \newline extern "C" void estern\_ce(natl id)\{ \newline \newline // recuperare periferica \newline for(;;)\{ \newline \newline // sem\_wait(mutex); \newline // libera il sync occupato nella primitiva \newline // sem\_signal(sync); \newline // sem\_signal(mutex); \newline \newline wfi(); \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Metodi di scorrimento tab\_iter}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{`it.post()}}; it; {\bf{it.next\_post()`}} & Effettua un accesso {\bf{posticipato}}. Viene solitamente utilizzato quando devo {\bf{cancellare}} un albero. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} `tab\_iter it(esecuzione-\textgreater{}cr3, v, n); it; {\bf{it.next()}}` & Effettua un accesso {\bf{anticipato}}. Viene solitamente utilizzato quando si deve semplicemente {\bf{scorrere}} l'albero per farci operazioni di qualsiasi tipo. \tn % Row Count 14 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{inspronti e \seqsplit{inserimento\_lista(pronti}, esecuzione)}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{La primitiva \{\{nl\}\} ~~~~ `inspronti();` \{\{nl\}\} inserisce il processo in esecuzione {\bf{in testa}} alla coda pronti.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{La primitiva \{\{nl\}\} ~~~~ \seqsplit{`inserimento\_lista(pronti}, esecuzione);` \{\{nl\}\} inserisce il processo in esecuzione nella coda pronti {\bf{in maniera ordinata}}. Quindi, se nella coda pronti c'è un processo P1 con {\bf{priorità uguale}} a quella del processo in esecuzione, quest'ultimo verrà inserito nella lista {\bf{dopo}} il processo P1.} \tn % Row Count 10 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{`inspronti();`}} : esecuzione -\textgreater{} P1 \{\{nl\}\}} \tn % Row Count 11 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{`inserimento\_lista(pronti, esecuzione);`}} : P1 -\textgreater{} esecuzione} \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Primitive con tipo di ritorno}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Se abbiamo una primitiva del tipo \newline % Row Count 1 (+ 1) {\bf{`bool primitiva(parametri)`}} \newline % Row Count 2 (+ 1) dovremo implementarla in due modi diversi nel modulo sistema e nel modulo I/O. \newline % Row Count 4 (+ 2) {\bf{SISTEMA}}: non possiamo farle restituire un tipo (deve essere void), quindi il valore di ritorno dovremo inserirlo nel contesto del processo in esecuzione. \newline % Row Count 8 (+ 4) {\bf{`extern "C" void primitiva(parametri) \{`}} \newline % Row Count 9 (+ 1) {\bf{`//operazioni`}} \newline % Row Count 10 (+ 1) {\bf{`esecuzione-\textgreater{}contesto{[}I\_RAX{]} = valore\_ritorno;`}} \newline % Row Count 12 (+ 2) {\bf{`\}`}} \newline % Row Count 13 (+ 1) {\bf{I/O}}: possiamo utilizzare i tipi di ritorno delle primitive nel seguente modo: \newline % Row Count 15 (+ 2) {\bf{`extern "C" bool primitiva(parametri) \{`}} \newline % Row Count 16 (+ 1) {\bf{`//operazioni`}} \newline % Row Count 17 (+ 1) {\bf{`return valore\_ritorno;`}} \newline % Row Count 18 (+ 1) {\bf{`\}`}}% Row Count 19 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}