Question: 19. (24 points) Consider the C program below (on the next page) Assume that all fork() calls complete successfully. Answer the following questions: - (3

19. (24 points) Consider the C program below (on the next page)

Assume that all fork() calls complete successfully.

Answer the following questions:

- (3 points) What are the minimum and maximum values of the count value printed by the execution of the First Print Statement?

MIN = MAX =

- (3 points) How many times the Second Print Statement is executed in this program?

- (3 points) For every process you showed in the process hierarchy tree, indicate the number of times it executes the Second Print Statement

- (3 points) What are the minimum and maximum values of the count value printed by the execution of the Second Print Statement?

MIN = MAX =

CODE FOR QUESTION 19:

#include

#include

#include

int count = 0;

int main(void)

{

int i;

for (i=0; i<2; i++) {

fork();

count++;

printf("First:%d ", count); //First Print Statement

}

printf("Second:%d ", count); //Second Print Statement

return 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!