CS FundamentalsHardGATE CS (PYQ pattern)

A process has 4 threads on a single CPU. Each thread computes for 10 ms, makes a blocking disk read that takes 30 ms, then computes for another 10 ms. Threads are scheduled FCFS (in creation order, re-queued when their I/O completes), and switching costs nothing. When does the last thread finish under the many-to-one model (all user threads on one kernel thread) and under the one-to-one model?

  1. A. 200 ms and 80 ms
  2. B. 200 ms and 50 ms
  3. C. 80 ms and 80 ms
  4. D. 160 ms and 80 ms

Correct answer: A. 200 ms and 80 ms

Many-to-one: a blocking system call blocks the single kernel thread, so the 30 ms reads cannot overlap anything: 4 x (10 + 30 + 10) = 200 ms. One-to-one: first bursts run 0-10, 10-20, 20-30, 30-40; the reads finish at 40, 50, 60, 70, so the second bursts run 40-50, 50-60, 60-70, 70-80. 160 ms overlaps only the last read; 50 ms would need 4 CPUs.

More Operating Systems questions

Exams that ask this topic