Question: 25. Consider the C program given below (on the next page). Assume that all fork) and wait) calls complete successfully Answer the following questions: -

 25. Consider the C program given below (on the next page).

25. Consider the C program given below (on the next page). Assume that all fork) and wait) calls complete successfully Answer the following questions: - How many processes are created during the execution of this program (including the "parent" process)? Draw the process hierarchy tree for this program. In which order did the processes in the hierarchy tree start and complete? Why? Explain your answer Which processes (among those in the hierarchy tree) will execute the line marked by Do Computation". Explain your answer PROGRAM FOR QUESTION 25 include include #include *include # include unistd.h> main() pidt pid, pid2; int status, status2 pid-fork )i if (pid0) pid2 fork ) if (pid20) /* Do Computation else pid2>0 wait (&status2) printf(" Process %d completed ", pi d2); else(pid > 0) wait &status) ; printf(" Another process %d completed ", pid); exit (0)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!