GATE | GATE CS 2012 | Question 8
A process executes the code
fork(); fork(); fork();
The total number of child processes created is
Explanation: Let us put some label names for the three lines
fork (); // Line 1 fork (); // Line 2 fork (); // Line 3 L1 // There will be 1 child process created by line 1 / \ L2 L2 // There will be 2 child processes created by line 2 / \ / \ L3 L3 L3 L3 // There will be 4 child processes created by line 3
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.