GATE - 2012 | OS | A process executes the code fork(); fork(); fork(); The total number of child

GATE - 2012 | OS | A process executes the code fork(); fork(); fork(); The total number of child
Posted on 12-02-2022

GATE - 2012 [Operating System]

Question:

A process executes the code
fork();
fork();
fork();
The total number of child processes created is
A
3
B
4
C
7
D
8

    

Solution:

Option (c) is Correct.

The no. of child process created = 2n -1 = 23 -1 = 7 (where n is number of fork() statements)
7 are child processes.

Thank You