Including the initial parent process how many processes are


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?)

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Including the initial parent process how many processes are
Reference No:- TGS02910604

Expected delivery within 24 Hours