<HTML> <HEAD> <TITLE>Compito di Sistemi Operativi, 20/6/2000</TITLE> </HEAD> <BODY > <DIV ALIGN="CENTER"> <FONT SIZE="+1"> <B> Compito di Sistemi Operativi, Prof. Mancini: </B></FONT> <I> <b> 20 giugno 2000<br> <br> </b></I> <hr> <hr> <p><b><font size="5">TESTO</font></b></p> <hr> <p> </DIV> <OL> <LI>(punti: -1,4) <BR> Se un sistema è <EM> multiprogrammato</EM> allora: <OL> <LI>il modello concorrente dei processi non consente la condivisione dei dati fra processi diversi; </LI> <LI>la migliore utilizzazione del processore permette di ridurre il valore medio del tempo di permanenza nel sistema dei lavori sottomessi dagli utenti e quindi il tempo di esecuzione di ogni singolo lavoro è minore di quello che risulterebbe in un sistema uniprogrammato; </LI> <LI>la migliore utilizzazione del processore permette di ridurre il valore medio del tempo di permanenza nel sistema dei lavori sottomessi dagli utenti ma il tempo di esecuzione di ogni singolo lavoro è maggiore di quello che risulterebbe in un sistema uniprogrammato; </LI> <LI>la peggiore utilizzazione del processore non permette di ridurre il valore medio del tempo di permanenza nel sistema dei lavori sottomessi dagli utenti e quindi il tempo di esecuzione di ogni singolo lavoro è maggiore di quello che risulterebbe in un sistema uniprogrammato; </LI> <LI>la peggiore utilizzazione del processore non permette di ridurre il valore medio del tempo di permanenza nel sistema dei lavori sottomessi dagli utenti ma il tempo di esecuzione di ogni singolo lavoro è minore di quello che risulterebbe in un sistema uniprogrammato; </LI> <LI>più attività vengono eseguite concorrentemente, una sola di esse svolge un servizio di stretta pertinenza dell'utente; </LI> <LI>più attività vengono eseguite concorrentemente, più d'una di esse può svolgere un servizio di stretta pertinenza dell'utente; </LI> <LI>nessuna delle affermazioni precedenti è corretta. </LI> </OL> </LI> <LI>(punti: -1,4) <BR> Il controllo del vettore delle maschere <EM> MV</EM> viene effettuato dalle primitive <EM> hP</EM> ed <EM> hV</EM>. In particolare: <OL> <LI>l'assegnamento <EM> MV[i]=false</EM> viene eseguito esclusivamente dalla primitiva <EM> hP(i)</EM> quando, trovando <EM> IV[i]=false</EM>, sospende il processo di controllo; </LI> <LI>l'assegnamento <EM> MV[i]=false</EM> viene eseguito esclusivamente dalla primitiva <EM> hP(i)</EM> quando, trovando <EM> IV[i]=true</EM>, sospende il processo di controllo; </LI> <LI>l'assegnamento <EM> MV[i]=false</EM> viene eseguito esclusivamente dalla primitiva <EM> hV(i)</EM>, appena questa primitiva viene attivata dal riconoscimento dell'interruzione <EM> IV[i]</EM>. </LI> <LI>l'assegnamento <EM> MV[i]=true</EM> viene eseguito esclusivamente dalla primitiva <EM> hP(i)</EM> quando, trovando <EM> IV[i]=false</EM>, sospende il processo di controllo; </LI> <LI>l'assegnamento <EM> MV[i]=true</EM> viene eseguito esclusivamente dalla primitiva <EM> hP(i)</EM> quando, trovando <EM> IV[i]=true</EM>, sospende il processo di controllo; </LI> <LI>l'assegnamento <EM> MV[i]=true</EM> viene eseguito esclusivamente dalla primitiva <EM> hV(i)</EM>, appena questa primitiva viene attivata dal riconoscimento dell'interruzione <EM> IV[i]</EM>. </LI> <LI>nessuna delle affermazioni precedenti è corretta. </LI> </OL> </LI> <LI>(punti: -1,4) <BR> Il codice del seguente processo <i><b>P</b></i> contiene una chiamata alla primitiva <EM> fork</EM> di Unix che termina con successo e genera un processo figlio <i><b>P<sub>i</sub></b></i>: <PRE> if (fork = 0) { codice-A } else { exec codice-B } codice-D </PRE> <OL> <LI>Il processo <i><b>P</b></i> esegue sicuramente il codice-A e potrebbe eseguire il codice-D; </LI> <LI>Il processo <i><b>P</b></i> esegue sicuramente il codice-A e non esegue mai il codice-D; </LI> <LI>Il processo <i><b>P<sub>i</sub></b></i> esegue sicuramente il codice-B e potrebbe eseguire il codice-D; </LI> <LI>Il processo <i><b>P<sub>i</sub></b></i> esegue sicuramente il codice-B e non esegue mai il codice-D; </LI> <LI>Il processo <i><b>P</b></i> esegue sicuramente il codice-B e potrebbe eseguire il codice-D; </LI> <LI>Il processo <i><b>P</b></i> esegue sicuramente il codice-B e non esegue mai il codice-D; </LI> <LI>Il processo <i><b>P<sub>i</sub></b></i> esegue sicuramente il codice-D e potrebbe eseguire il codice-B; </LI> <LI>Il processo <i><b>P<sub>i</sub></b></i> esegue sicuramente il codice-D e non esegue mai il codice-B; </LI> <LI>Il processo <i><b>P<sub>i</sub></b></i> esegue sicuramente il codice-A e potrebbe eseguire il codice-D; </LI> <LI>Il processo <i><b>P<sub>i</sub></b></i> esegue sicuramente il codice-A e non esegue mai il codice-D; </LI> <LI>nessuna delle affermazioni precedenti è corretta. </LI> </OL> </LI> <LI>(punti: -1,4) <BR> Quali delle seguenti strutture dati appartengono al sistema di archiviazione di Unix: <OL> <LI>La <!-- MATH $TabellaDeiCollegamenti$ --> <i><b>TabellaDeiCollegamenti</b></i>, o file table, registra lo stato di assegnazione su disco dei descrittori di archivio; </LI> <LI>La <!-- MATH $TabellaDeiDescrittoriInMS$ --> <i><b>TabellaDeiDescrittoriInMS</b></i>, o file table, contiene i puntatori alla posizione corrente degli archivi aperti; </LI> <LI>La <!-- MATH $TabellaDeiCollegamenti$ --> <i><b>TabellaDeiCollegamenti</b></i>, o file table, contiene, fra l'altro, i puntatori alla posizione corrente degli archivi aperti; </LI> <LI>La <!-- MATH $TabellaDeiDescrittoriInMS$ --> <i><b>TabellaDeiDescrittoriInMS</b></i>, o tabella I-node, contiene le copie dei descrittori di archivio in uso da parte di almeno un processo; </LI> <LI>La <!-- MATH $TabellaDeiCollegamenti$ --> <i><b>TabellaDeiCollegamenti</b></i>, o tabella I-node, ogni elemento registra la cardinalità dell'insieme di processi che stanno utilizzando l'archivio ad esso associato; </LI> <LI>La <!-- MATH $TabellaDeiDescrittoriInMS$ --> <i><b>TabellaDeiDescrittoriInMS</b></i>, o tabella I-node, ogni elemento registra la cardinalità dell'insieme di processi che stanno utilizzando l'archivio ad esso associato; </LI> <LI>nessuna delle affermazioni precedenti è corretta. </LI> </OL> </LI> <LI>(punti: -1.5,4) <BR> Assumendo in ogni caso un comportamento bloccante per la primitiva <B> receive</B>: <OL> <LI>la forma di comunicazione chiamata ``rendez-vous esteso'' richiede un comportamento non bloccante della send; </LI> <LI>la forma di comunicazione chiamata ``rendez-vous esteso'' richiede un comportamento bloccante della send; </LI> <LI>i modelli di comunicazione si dicono sincroni, se la send ha un comportamento bloccante; </LI> <LI>i modelli di comunicazione si dicono sincroni, se la send non ha un comportamento bloccante; </LI> <LI>la forma di comunicazione chiamata ``rendez-vous'' richiede un comportamento non bloccante della send; </LI> <LI>la forma di comunicazione chiamata ``rendez-vous'' richiede un comportamento bloccante della send; </LI> <LI>nessuna delle affermazioni precedenti è corretta. </LI> </OL> </LI> <LI>(punti: 6) <BR> Illustrare in al più 70 parole la nozione di <EM> semaforo</EM>. </LI> <LI>(punti: 6) <BR> Discutere in al più 70 parole la transizione dei processi dallo stato di pronto a quello di esecuzione e viceversa. </LI> <LI>(punti: 6) <BR> Considerare un insieme di cinque processi <i><b>P<sub>1</sub></b></i>, <i><b>P<sub>2</sub></b></i>, <i><b>P<sub>3</sub></b></i>, <i><b>P<sub>4</sub></b></i>, <i><b>P<sub>5</sub></b></i> con i seguenti tempi di arrivo e tempi di esecuzione in millisecondi: <TABLE CELLPADDING=3 BORDER="1"> <TR><TD ALIGN="LEFT">Processo</TD> <TD ALIGN="LEFT">Tempo di arrivo</TD> <TD ALIGN="LEFT">Tempo di esecuzione</TD> </TR> <TR><TD ALIGN="LEFT"><i><b>P<sub>1</sub></b></i></TD> <TD ALIGN="LEFT">0</TD> <TD ALIGN="LEFT">16</TD> </TR> <TR><TD ALIGN="LEFT"><i><b>P<sub>2</sub></b></i></TD> <TD ALIGN="LEFT">5</TD> <TD ALIGN="LEFT">11</TD> </TR> <TR><TD ALIGN="LEFT"><i><b>P<sub>3</sub></b></i></TD> <TD ALIGN="LEFT">9</TD> <TD ALIGN="LEFT">9</TD> </TR> <TR><TD ALIGN="LEFT"><i><b>P<sub>4</sub></b></i></TD> <TD ALIGN="LEFT">13</TD> <TD ALIGN="LEFT">7</TD> </TR> <TR><TD ALIGN="LEFT"><i><b>P<sub>5</sub></b></i></TD> <TD ALIGN="LEFT">7</TD> <TD ALIGN="LEFT">10</TD> </TR> </TABLE> Assegnare questo insieme di processi ad un processore in base alla politica Round Robin considerando un quanto di tempo di 4 millisecondi. Calcolare il valor medio del tempo di attesa ed il valor medio del tempo di turnaround dei processi. </LI> <LI>Considerare la seguente stringa di riferimenti alla memoria di un processo in un sistema con memoria virtuale <BR> S = 9 3 1 0 5 2 1 3 9 5 0 1 4 2 0 3 6 2 9 1 <OL> <LI>(punti: 3) <BR> Illustrare il comportamento dell'algoritmo LRU di sostituzione delle pagine per una memoria fisica di 5 blocchi. Calcolare il numero di page fault che si verificano. </LI> <LI>(punti: 3) <BR> Illustrare il comportamento dell'algoritmo Second Chance di sostituzione delle pagine per una memoria fisica di 5 blocchi. Calcolare il numero di page fault che si verificano. </LI> </OL> </LI> <LI>(punti: 9) <BR> Considerare un insieme di processi che interagiscono mediante una variabile condivisa di tipo stringa. I processi si dividono in scrittori e lettori. I primi assegnano un valore alla variabile, e nel fare ciò, escludono qualsiasi altro processo dall'accedervi. I lettori leggono il valore della variabile, e nel fare ciò, escludono i processi scrittori ma non altri lettori. Definire una classe Java che implementi processi (thread) scrittori ed una che implementi i processi lettori. </LI> </OL> <hr> <hr> <p align="center"><B><font size="5"> Risposte Compito di Sistemi Operativi, 20/6/2000</font></B> </p> <hr> <OL> <LI>c, g<br> </LI> <LI> c, d<br> </LI> <LI>f, i<br> </LI> <LI> <p align="left">c, d<br> </LI> <LI>a, c, f<br> </LI> <LI><br> </LI> <LI><br> </LI> <LI>Politica Round Robin </LI> </OL> <div align="center"> <center> <table border="1" width="963" height="19"> <tr> <td width="57" height="19" align="center" bgcolor="#C0C0C0"> <p align="center">P1</td> <td width="57" height="19" align="center" bgcolor="#C0C0C0"> <p align="center">P1</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P2</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P5</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P1</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P3</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P2</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P4</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P5</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P1</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P3</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P2</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P4</td> <td width="58" height="19" align="center" bgcolor="#C0C0C0">P5</td> <td width="79" height="19" align="center" bgcolor="#C0C0C0">P3</td> </tr> <tr> <td width="57" height="19" align="center"> </td> <td width="57" height="19" align="center"> </td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="58" height="19" align="center"></td> <td width="79" height="19" align="center"></td> </tr> <tr> <td width="57" height="33" align="center"><font size="3">0-4ms</font></td> <td width="57" height="33" align="center"><font size="3">4-8</font></td> <td width="58" height="33" align="center"><font size="3">8-12</font></td> <td width="58" height="33" align="center"><font size="3">12-16</font></td> <td width="58" height="33" align="center"><font size="3">16-20</font></td> <td width="58" height="33" align="center"><font size="3">20-24</font></td> <td width="58" height="33" align="center"><font size="3">24-28</font></td> <td width="58" height="33" align="center"><font size="3">28-32</font></td> <td width="58" height="33" align="center"><font size="3">32-36</font></td> <td width="58" height="33" align="center"><font size="3">36-40</font></td> <td width="58" height="33" align="center"><font size="3">40-44</font></td> <td width="58" height="33" align="center"><font size="3">44-47</font></td> <td width="58" height="33" align="center"><font size="3">47-50</font></td> <td width="58" height="33" align="center"><font size="3">50-52</font></td> <td width="79" height="33" align="center">52 - 53</td> </center> <td width="70" height="33" align="center"> <p align="left">53ms</p> </td> </tr> <center> </table> </center> </div> <p> Tempo medio d'attesa: 155/5=31<br> Turn Around medio: 208/5<br> </p> <hr align="left"> <ol start="9"> <li> <ol start="7" type="a"> <li value="1"><u>ALGORITMO LRU<br> <br> </u> <span style="background-color: #FF0000">Pagina Riferita</span></li> </ol> </li> </ol> <div align="center"> <center> <table border="1" width="728" height="39"> <tr> <td width="34" height="39" bgcolor="#C0C0C0" align="center"> </td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">9</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">3</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">1</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">0</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">5</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">2</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">1</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">3</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">9</td> <td width="34" height="39" bgcolor="#C0C0C0" align="center">5</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">0</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">1</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">4</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">2</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">0</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">3</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">6</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">2</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">9</td> <td width="35" height="39" bgcolor="#C0C0C0" align="center">1</td> </tr> <tr> <td width="34" height="39" bordercolor="#C0C0C0" bgcolor="#C0C0C0" align="center">0</td> <td width="34" height="39" align="center" bgcolor="#FF0000"><span style="background-color: #FF0000">9</span></td> <td width="34" height="39" align="center">9</td> <td width="34" height="39" align="center">9</td> <td width="34" height="39" align="center">9</td> <td width="34" height="39" align="center">9</td> <td width="34" height="39" align="center" bgcolor="#FF0000"><span style="background-color: #FF0000">2</span></td> <td width="34" height="39" align="center">2</td> <td width="34" height="39" align="center">2</td> <td width="34" height="39" align="center">2</td> <td width="34" height="39" align="center">2</td> <td width="35" height="39" align="center" bgcolor="#FF0000">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center" bgcolor="#FF0000">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center">0</td> <td width="35" height="39" align="center" bgcolor="#FF0000">1</td> </tr> <tr> <td width="34" height="39" bordercolor="#C0C0C0" bgcolor="#C0C0C0" align="center">1</td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center" bgcolor="#FF0000">3</td> <td width="34" height="39" align="center">3</td> <td width="34" height="39" align="center">3</td> <td width="34" height="39" align="center">3</td> <td width="34" height="39" align="center">3</td> <td width="34" height="39" align="center">3</td> <td width="34" height="39" align="center" bgcolor="#FF0000">3</td> <td width="34" height="39" align="center">3</td> <td width="34" height="39" align="center">3</td> <td width="35" height="39" align="center">3</td> <td width="35" height="39" align="center">3</td> <td width="35" height="39" align="center" bgcolor="#FF0000">4</td> <td width="35" height="39" align="center">4</td> <td width="35" height="39" align="center">4</td> <td width="35" height="39" align="center">4</td> <td width="35" height="39" align="center">4</td> <td width="35" height="39" align="center">4</td> <td width="35" height="39" align="center" bgcolor="#FF0000">9</td> <td width="35" height="39" align="center">9</td> </tr> <tr> <td width="34" height="39" bordercolor="#C0C0C0" bgcolor="#C0C0C0" align="center">2</td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center" bgcolor="#FF0000">1</td> <td width="34" height="39" align="center">1</td> <td width="34" height="39" align="center">1</td> <td width="34" height="39" align="center">1</td> <td width="34" height="39" align="center" bgcolor="#FF0000">1</td> <td width="34" height="39" align="center">1</td> <td width="34" height="39" align="center">1</td> <td width="34" height="39" align="center">1</td> <td width="35" height="39" align="center">1</td> <td width="35" height="39" align="center" bgcolor="#FF0000">1</td> <td width="35" height="39" align="center">1</td> <td width="35" height="39" align="center">1</td> <td width="35" height="39" align="center">1</td> <td width="35" height="39" align="center">1</td> <td width="35" height="39" align="center" bgcolor="#FF0000">6</td> <td width="35" height="39" align="center">6</td> <td width="35" height="39" align="center">6</td> <td width="35" height="39" align="center">6</td> </tr> <tr> <td width="34" height="39" bordercolor="#C0C0C0" bgcolor="#C0C0C0" align="center">3</td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center" bgcolor="#FF0000">0</td> <td width="34" height="39" align="center">0</td> <td width="34" height="39" align="center">0</td> <td width="34" height="39" align="center">0</td> <td width="34" height="39" align="center">0</td> <td width="34" height="39" align="center" bgcolor="#FF0000">9</td> <td width="34" height="39" align="center">9</td> <td width="35" height="39" align="center">9</td> <td width="35" height="39" align="center">9</td> <td width="35" height="39" align="center">9</td> <td width="35" height="39" align="center" bgcolor="#FF0000">2</td> <td width="35" height="39" align="center">2</td> <td width="35" height="39" align="center">2</td> <td width="35" height="39" align="center">2</td> <td width="35" height="39" align="center" bgcolor="#FF0000">2</td> <td width="35" height="39" align="center">2</td> <td width="35" height="39" align="center">2</td> </tr> <tr> <td width="34" height="39" bordercolor="#C0C0C0" bgcolor="#C0C0C0" align="center">4</td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center" bgcolor="#FF0000">5</td> <td width="34" height="39" align="center">5</td> <td width="34" height="39" align="center">5</td> <td width="34" height="39" align="center">5</td> <td width="34" height="39" align="center">5</td> <td width="34" height="39" align="center" bgcolor="#FF0000">5</td> <td width="35" height="39" align="center">5</td> <td width="35" height="39" align="center">5</td> <td width="35" height="39" align="center">5</td> <td width="35" height="39" align="center">5</td> <td width="35" height="39" align="center">5</td> <td width="35" height="39" align="center" bgcolor="#FF0000">3</td> <td width="35" height="39" align="center">3</td> <td width="35" height="39" align="center">3</td> <td width="35" height="39" align="center">3</td> <td width="35" height="39" align="center">3</td> </tr> <tr> <td width="34" height="39" bordercolor="#C0C0C0" align="center"></td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center"></td> <td width="34" height="39" align="center">P</td> <td width="34" height="39" align="center"></td> <td width="35" height="39" align="center">P</td> <td width="35" height="39" align="center"></td> <td width="35" height="39" align="center">P</td> <td width="35" height="39" align="center">P</td> <td width="35" height="39" align="center"></td> <td width="35" height="39" align="center">P</td> <td width="35" height="39" align="center">P</td> <td width="35" height="39" align="center"></td> <td width="35" height="39" align="center">P</td> <td width="35" height="39" align="center">P</td> </tr> </table> </center> </div> <p> = 14 page fault</p> <p> </p> <p> </p> <p> </p> </BODY> </HTML>
This topic: Sistemioperativi1
>
20Giugno2000
Topic revision: r1 - 2001-12-17 - AntonioValletta
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback