A process executes the code
fork(); fork(); fork();
The total number of child processes created is
GATE CSE 2012Operating System › Process Concepts, Threads & System CallsVerified
(C) 7 7 7
Model process creation as a doubling process. Every time any existing process executes a fork() call, the total number of processes in the system doubles (the caller continues as parent, and one new child is added). So after the three fork() calls the total process count is $2^3 = 8$. Exactly one of these is the original parent; the rest are children. Hence the number of child processes is 8 - 1 = 7 = $2^3 - 1$.
Each fork() doubles the number of processes, so three forks yield $2^3 = 8$ processes in total. Since exactly one process is the original parent and never counts as its own child, the number of children is $2^3 - 1 = 7$. Therefore option C is correct.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.