Question: Draw the corresponding process tree for the code below. Use circles to model processes. Also picture pipes ( using a cylinder ) and show fork,
Draw the corresponding process tree for the code below. Use circles to model processes. Also
picture pipes using a cylinder and show fork, exec, wait, and pipe function calls. Use the next
page for this
What is the written on STDOUT and STDERR? Assume the starting process id is
const int NUMKIDS ;
const int MSGSIZE ;
int main
int fdNUM KIDS;
pidt pidMMKIDS;
cerr "Start pid: getpid endl;
for int ; NUM KIDS;
pipe fdi;
pidi fork; Assume no error
if pidi
cerr i i pid: getpid endl;
close fdi;
dupfdi;
cout getpid i endl;
exit ;
else
close fdi;
for int ; NUMKIDS;
char msgMSGSIZE;
readfdi msg MSGSIZE;
cout msg: msg endl;
waitpidpidi NULL, ; Block and wait
close fdi;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
