5 votes 5 votes Consider the following piece of C code: void main( ) { fork( ); fork( ); exit( ); } How many child processes are created upon execution of this program? Operating System tanenbaum operating-system process-and-threads fork-system-call descriptive + – admin asked Oct 25, 2019 admin 3.4k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes Total child process = 2^n -1 , where n is number of time fork will call 2^2-1 =3 inc0gnito answered Nov 14, 2019 inc0gnito comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes here fork() fnction is executing twice and n=2. we the nos of child processes are (2^n)-1= (2^2)-1=4-1=3 DIBAKAR MAJEE answered May 4, 2020 DIBAKAR MAJEE comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Generally when a fork is called for n times then total number of child processes that is generated is 2^(n)-1 In the above problem it is called 2 times so it generates 2^(2)-1 =3 number of child processes will be generated. Arnabvasudev23 answered Jul 18, 2020 Arnabvasudev23 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes No of child processes created is 2^n-1. Here n is the number of times fork is called. eshita1997 answered Sep 13, 2020 eshita1997 comment Share Follow See all 0 reply Please log in or register to add a comment.