Question discussion

How many processes (including the original process) exist after the following code segment is executed?fork(); fork(); fork();

2108Medium DSSSB TGT Computer Science 0 replies 1 views
0

How many processes (including the original process) exist after the following code segment is executed?

fork();
fork();
fork();
  • A3
  • B6
  • C7
  • D8
Correct answer: D

Explanation

Every fork() doubles the number of processes, so three successive calls give 2 × 2 × 2 = 8 processes.

Discussion 0

Nobody has replied yet. Start the discussion!