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?
- A. 200 ms and 80 ms
- B. 200 ms and 50 ms
- C. 80 ms and 80 ms
- 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
- A 4-level x86-64 style page table maps 4 KB pages through all four levels, 2 MB pages with the third-level entry as the leaf and 1 GB…
- A data TLB has 64 entries and the OS backs a 1.5 GB array with 2 MB pages. A program accesses array elements uniformly at random and…
- Reference string: 8, 6, 5, 3, 3, 1, 6, 8, 2, 6, 1, 7, 3, 8, 7, 3, 3, 4, 1, 2, 3, 2, 7, 2, 5, 4, 4, 7, 2, 5. What is the smallest number of…
- SRTF with processes (arrival, burst) in ms: P1 (0, 10), P2 (1, 6), P3 (2, 3), P4 (3, 8), P5 (5, 1), P6 (6, 2). Ties go to the earlier…
- Fixed priorities H > M > L, preemptive, one CPU. L arrives at 0: computes 2 ms, locks mutex m, computes 4 ms, unlocks, computes 1 ms. M…
- A bounded buffer has 3 slots: empty = 3, full = 0, mutex = 1 (classic implementation where a blocked wait leaves the semaphore negative)…