Question: Part 1 & 2 Consider that the system calls do not fail, function f ( ) never returns or exits, f ( ) does not
Part & Consider that the system calls do not fail, function f never returns or exits, f does not execute system calls, each new process inherits exactly the way signals are handled by the parent process. Assume that process executes this program, and thereon every new process forked has its pid incremented by
Part pts: Explain how the program works.
Part pts: Draw the process tree in its final form, ie when all processes have reached a steady state. Solve potential race condition, assuming that at least three processes arrive at the point marked A passing the read in the order of their birth. At each node of the tree process please highlight:
i the system call or a function where the Program Counter of the corresponding process is found, ii the arguments with which the function f has been called,
iii the program line from which the call took place.
iv Complete the process tree to show the interprocess communication using arrows and type above the arrow the value that is transferred each time.
int fd;
void handlerint signum
exit; f;
int mainvoid
int i j n;
char c;
pidt pid;
signalSIGUSR handler;
pipefd;
for i ; i ; i
pidi fork;
if pidi
n readfd c i ;
A
for j ; j n; j
pidi fork;
if pidi
fgetpid j;
for j ; j i; j
waitNULL;
fi;
exit;
killpidi SIGUSR;
for i ; i ; i
wait&n;
writefd c WEXITSTATUSn;
fi;
return ;
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
