linux fork system call

Viewed 485

Recently I faced an technical interview in a reputed IT firm. the interviewer asked me about how many processes will be created if the following 3 different fork system call invocations are given:

  1. fork()

  2. fork()
    fork()

  3. fork()
    fork()
    fork()

The answer to first was obvious 2 processes.
2nd one will start 3 processes.
bt the 3rd I told was 5 processes, the interviewer disagreed and said its 7.
I cannot figure out how did it create 7 processes.
Please help.

4 Answers
Related