Question: #include include include #include nt nain() { int nun-21 int pid = fork(); if (pld--) nun = num + 8; pld fork) if (pid !=

 #include include include #include nt nain() { int nun-21 int pid

#include include include #include nt nain() { int nun-21 int pid = fork(); if (pld--) nun = num + 8; pld fork) if (pid != 0) wait (NULL); else pld fork) nun = num+ 12; unnum 20; fork valt(NULL printf"dn",num) return 0; a. [8] Ifall forks are successful, how many processes are created by running this piece of code? Include main (0) in your answer. To support your answer, you must draw a tree diagram showing the hierarchy of processes that are created as the program runs. Number the process as we did in class, where main is 0, children of 0 are 1,2,3. thfirst child of is 11, the second child of 1 is 12, the first child of 2 is 21, etc b. 3] Does this code result in any zombie processes? Why or why not? c 5 What would the process tree look like if an exec system call that executed the 1. command were inserted between the second int num 2 and third int pid fork instructions

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!