Question: For the following program, (1) sketch the corresponding process tree being sure to indicate any outputs and synchronization points, if they exist and (2)
For the following program, (1) sketch the corresponding process tree being sure to indicate any outputs and synchronization points, if they exist and (2) write down the output it will produce when executed. int done = 0; void handler (int sig) { printf ("0"); done = 1; } main() { } pid_t pid; int status; signal (SIGUSR1, handler); if ((pid = fork()) EB 0) { while (!done) ; printf("1"); exit (2) ; } else { printf("3"); kill (pid, SIGUSR1); if (wait (&status) > 0) printf ("%d", WEXITSTATUS (status)); } if (done) printf("4"); else printf("5");
Step by Step Solution
3.29 Rating (146 Votes )
There are 3 Steps involved in it
Solution We can draw for simplicity and for understanding in this ... View full answer
Get step-by-step solutions from verified subject matter experts
