(a) How many processes are needed for the execution of the code fragment below? Dont forget to...
Question:
(a) How many processes are needed for the execution of the code fragment below? Don’t forget to count the process that executes the main routine itself. Show your work.
(b) How many pipes are being created in the code fragment below? Explain your answer.
(c) How many processes are sharing the same pipe? If your answer for problem (b) is more than one, you must give an answer for each pipe in this problem. You can designate each pipe with a number in the same order that it was created in the code fragment below. Explain your answer.
main( ) {
:
pipe( );
pid0 = fork( );
pid1 = fork( );
if(!pid0) execvp( );
else pipe( );
pid2 = fork( );
if(pid1) pipe ( );
if(!pid2) execvp( );
else pid3 = fork( );
execvp( );
pid4 = fork( );
if(pid4) pipe( );
else execvp( );
:
}
Statistics for Business and Economics
ISBN: 978-0321826237
12th edition
Authors: James T. McClave, P. George Benson, Terry T Sincich