System Call · Operating System
16 questions · asked in 11 of 27 years (2000–2026)
MCQ 11 · MSQ 2 · NAT 31-mark 12 · 2-mark 4
2000Questions per year2026
Questions 16–16 of 16
A process executes the following segment of code :
for(i = 1; i <= n; i++)
fork ();
The number of new processes created is
Answer: (C)
Each call to fork() creates one new process, and the new process continues the loop too. So every loop iteration doubles the number of processes.
After each iteration the total is 1, 2, 4, 8, ..., after iterations. One of these is the original process, so the number of new processes is . For : the parent forks C1; then the parent forks C2 and C1 forks C3, which is new processes.
Answer: (C)
After each iteration the total is 1, 2, 4, 8, ..., after iterations. One of these is the original process, so the number of new processes is . For : the parent forks C1; then the parent forks C2 and C1 forks C3, which is new processes.
Answer: (C)
Keep practising