CS FundamentalsModerateGATE CS
A process calls fork() three times in sequence and every child also continues the code. Afterwards, how many processes exist and how many of them are children (not the original)?
- A. 6 and 5
- B. 8 and 7
- C. 8 and 8
- D. 3 and 3
Correct answer: B. 8 and 7
Each fork doubles the number of processes: 2³ = 8 in total, of which 7 were created by fork.
More Operating Systems questions
- What is printed? (fork succeeds.) c int x = 10; int main() { if (fork() == 0) { x += 5; printf("%d ", x); } else { wait(NULL); x -= 5…
- A parent process exits without calling wait() while its child is still running. What happens to the child?
- After a successful exec() call, which of these is preserved from the calling process?
- Disk cylinders 0–199; the head is at 50. Requests in arrival order: 82, 170, 43, 140, 24, 16, 190. What is the total head movement under…
- Disk cylinders 0–199; head at 50, moving toward 199. Requests: 82, 170, 43, 140, 24, 16, 190. What is the total head movement under SCAN…
- Disk cylinders 0–199; head at 50, moving toward 199. Requests: 82, 170, 43, 140, 24, 16, 190. Under C-SCAN, counting the return sweep from…