[Solved]Consider Following Program 1int Main 2nt Count1 3 Int Pid 0 Pid2 0 4if Pid Fork Count Coun Q37165974

Consider the following program: 1int main) 2nt count1; 3 int pid 0,pid2-0 4if ((pid – fork))) count-count 2; printf(“%d “, count); 8 if (count 1) count++ pid2-fork) printf(“%d “, 12 13 14 if(pid2){ 15 16 17 18 19 > count); wa i tpid(pid2, NULL, θ); countcount*2; printf(“%d “, count); a. How many processes are created during the execution of this program? Explain b. List all the possible outputs of the program c. If we delete line 15 (the waitpid) show one output that is possible in the new program that is not possible in the old program Show transcribed image text Consider the following program: 1int main) 2nt count1; 3 int pid 0,pid2-0 4if ((pid – fork))) count-count 2; printf(“%d “, count); 8 if (count 1) count++ pid2-fork) printf(“%d “, 12 13 14 if(pid2){ 15 16 17 18 19 > count); wa i tpid(pid2, NULL, θ); countcount*2; printf(“%d “, count); a. How many processes are created during the execution of this program? Explain b. List all the possible outputs of the program c. If we delete line 15 (the waitpid) show one output that is possible in the new program that is not possible in the old program
Expert Answer
Answer to Consider the following program: 1int main) 2nt count1; 3 int pid 0,pid2-0 4if ((pid – fork))) count-count 2; printf(“%d … . . .
OR

