CS FundamentalsVery hardGATE CS (PYQ pattern)
Four processes (arrival, burst) in ms: A (0, 7), B (1, 2), C (2, 1), D (2, 2). Scheduling is non-preemptive. Compare non-preemptive SJF (at each completion pick the shortest ARRIVED job; ties by arrival) with the best possible non-preemptive schedule, which may keep the CPU idle on purpose. What are the average waiting times (SJF, optimal)?
- A. 5.0 ms and 2.25 ms
- B. 5.0 ms and 5.0 ms
- C. 4.0 ms and 2.25 ms
- D. 5.0 ms and 1.5 ms
Correct answer: A. 5.0 ms and 2.25 ms
SJF must start A at 0 (nothing else has arrived), then C (7-8), B (8-10), D (10-12): waits 0, 5, 7, 8 = 20, average 5.0. Idling until t = 1 and running B, C, D, A starts them at 1, 3, 4, 6: waits 0, 1, 2, 6 = 9, average 2.25, the minimum over all orders. SJF is optimal only when all jobs are present at once; 1.5 ignores that B cannot start before t = 1.
More Operating Systems questions
- A 2-slot bounded buffer uses mutex = 1, empty = 2, full = 0. Two producers each insert 2 items with the (buggy) code wait(mutex)…
- SRTF (preemptive shortest remaining time first; ties go to the earlier arrival) is used for processes (arrival, burst) in ms: P1 (0, 9)…
- Preemptive priority scheduling (a smaller number means higher priority; equal priorities are served by earlier arrival, without time…
- A lottery scheduler holds a fresh draw every quantum. Process A has 100 tickets, B has 200 and C has 300 (every process always stays…
- Rate-monotonic scheduling (preemptive, deadline = period, all tasks released together at t = 0) is used for T1 (C = 1, period 4), T2 (C =…
- A 3-level paging system has a TLB (1 ns, hit ratio 95%) and a cache in front of memory (10 ns hit time, 90% hit ratio, and a miss costs 10…