User Tools

Site Tools


os:lab03
Return to Home page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
os:lab03 [2019/10/23 23:00]
zioskenz
os:lab03 [2019/10/30 14:17] (current)
zioskenz
Line 49: Line 49:
 ==== Exercise 02: System call fork and shell commands related to processes ==== ==== Exercise 02: System call fork and shell commands related to processes ====
  
-A program receives two integer values ​​on the command line, called ''​n''​ and ''​t''​. The program (parent process) must produce 2 children and terminate. In turn, each child must produce 2 children and terminate. This sequence of operations ​must process ​must continue until ''​2 ^ n''​ processes on the leaves of the tree are produced/​running. The leaf processes wait for ''​t''​ seconds and display (on screen) a termination message. Note that each process (in the tree) produces two other processes. Only those on the leaves of the tree sleep and display a message. What is the order of termination of the processes? Is it always the same? How can they be recognized (ppid)?+A program receives two integer values ​​on the command line, called ''​n''​ and ''​t''​. The program (parent process) must produce 2 children and terminate. In turn, each child must produce 2 children and terminate. This sequence of operations must continue until ''​2 ^ n''​ processes on the leaves of the tree are produced/​running. The leaf processes wait for ''​t''​ seconds and display (on screen) a termination message. Note that each process (in the tree) produces two other processes. Only those on the leaves of the tree sleep and display a message. What is the order of termination of the processes? Is it always the same? How can they be recognized (ppid)?
  
 Once the program has been executed: ​ Once the program has been executed: ​
Line 82: Line 82:
 Note that all arcs are oriented downwards. Each Pi process corresponds to a print message (print the string "​Pi"​ and the PID of the process). Note that all arcs are oriented downwards. Each Pi process corresponds to a print message (print the string "​Pi"​ and the PID of the process).
  
-Check the precedence are respected by inserting system call sleep in the various branches of the program.+Check the precedence are respected by inserting ​the system call ''​sleep'' ​in the various branches of the program.
  
-Si osservi che tutti gli archi sono orientati verso il basso. 
-Ogni processo Pi corrisponda a un messaggio di stampa 
-(si stampi la stringa "​Pi"​ e il PID del processo). 
- 
-Verificare le precedenza siano rispettate inserendo delle 
-system call sleep nei vari rami del programma. 

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/os/lab03?rev=1572441475&do=diff
/web/htdocs/www.skenz.it/home/data/pages/os/lab03.txt · Last modified: 2019/10/30 14:17 by zioskenz

Privacy Policy