Question: Question About Forking: Including the initial parent process, how many processes are created by the program shown below? Show through a diagram the tree of

Question About Forking:

Including the initial parent process, how many processes are created by the program shown below? Show through a diagram the tree of process created giving process labels as P1, P2, P3,

int main()

{

/* fork a child process */

fork();

/* Another fork */

fork();

int i;

for (i=0; i <5; i++)

fork();

/* fork another child process */

return 0; }

( I'd take a complete answer, but I'm mainly confused as to whether the initial 2 forks count in the "For" part of the process. Does int i start at i=0 or i=2? Would it go through a total of 4 forks or 6?)

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!