1 votes 1 votes closed with the note: it is allready on go. A process executes the code for( i=1; i<3; i++) fork(); fork(); The number of new process created is ?? if explanation is on paper with diagram then it is good for me . Shubham Aggarwal asked Sep 29, 2018 closed Sep 29, 2018 by Shubham Aggarwal Shubham Aggarwal 468 views comment Share Follow See all 11 Comments See all 11 11 Comments reply Shaik Masthan commented Sep 29, 2018 reply Follow Share i hope it is almost duplicate https://gateoverflow.in/231896/fork-system-call 0 votes 0 votes Shubham Aggarwal commented Sep 29, 2018 reply Follow Share ok i am going to close it. sorry i did't check before. 0 votes 0 votes arvin commented Sep 29, 2018 i edited by arvin Sep 29, 2018 reply Follow Share @shaikh masthan : brother this is indeed a different question... we will have 3fork() calls here... 0 votes 0 votes Shaik Masthan commented Sep 29, 2018 reply Follow Share the link which i provided has for ( i = 1; i<=3; i++ ) { fork(); fork(); } But in this question, it seems to be for ( i = 1; i<3; i++ ) { fork(); } fork(); // Line P For this question ===> after for loop, we have total 2n = 22 = 4 processes ( i=1 an i=2 but can't run at i = 3 ) but after Line P, there are 4*2 = 8 processes, in which only 1 is root call, 7 are newly created processes by fork. 3 votes 3 votes Shaik Masthan commented Sep 29, 2018 reply Follow Share brother this is indeed a different question... changing the values, doesn't mean it is different question., i gave clear explanation, in that link. if some one clearly read (understood) it, they didn't feel this question is also need to answer by someone. 0 votes 0 votes arvin commented Sep 29, 2018 reply Follow Share ok sure :) no problem 0 votes 0 votes Shubham Aggarwal commented Sep 29, 2018 reply Follow Share bro i got it.. ans is 15 0 votes 0 votes Shaik Masthan commented Sep 29, 2018 reply Follow Share How it is 15? 0 votes 0 votes Shubham Aggarwal commented Sep 29, 2018 reply Follow Share becoz there is no curly braces after loop so first fork () consider as three times and last is one so total four fork(). now for child process you can apply formula (2^N)-1 0 votes 0 votes Shaik Masthan commented Sep 29, 2018 reply Follow Share Did you read my previous comment? for loop runs only 2 times ( note that it is less than symbol in condition ) 0 votes 0 votes Shubham Aggarwal commented Sep 29, 2018 reply Follow Share sorry bro its my typing mistake in question.. there is equal to = symbol too. 0 votes 0 votes Please log in or register to add a comment.