CS FundamentalsEasyGATE CS (PYQ pattern)
SJF predicts each process's next CPU burst by exponential averaging, tau(n+1) = a x t(n) + (1 - a) x tau(n), with a = 0.5 and tau(0) = 10 ms for every process. The measured bursts so far (oldest first) are P1: 14, 15, 7; P2: 6, 7, 13; P3: 12, 7, 8 ms. All three are now ready. Which process does SJF pick, and with what predicted burst?
- A. P1, predicted 7 ms
- B. P3, predicted 8.5 ms
- C. P2, predicted 8.67 ms
- D. P2, predicted 10.25 ms
Correct answer: B. P3, predicted 8.5 ms
P1: 10 -> 12 -> 13.5 -> 10.25. P2: 10 -> 8 -> 7.5 -> 10.25. P3: 10 -> 11 -> 9 -> 8.5. P3 has the smallest prediction. Picking by the latest burst alone gives P1 (7 ms), by the plain mean gives P2 (8.67 ms); the average forgets old bursts geometrically, so P2's recent 13 ms burst outweighs its earlier short ones.
More Operating Systems questions
- Assume every fork() succeeds. for (int i = 0; i < 4; i++) { if (fork() == 0 && i % 2 == 1) execl("/bin/true", "true", NULL); }…
- A machine with 4 KB pages and demand paging has a 6-byte memory-to-memory MOVE instruction stored at virtual address 0x0FFC. It copies 300…
- Six threads each take two locks in a fixed order and hold the first while acquiring the second: T1 takes A then B, T2: B then C, T3: C…
- 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…
- 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)…