CS FundamentalsVery hardProduct company interview · GATE level
Processes (arrival, burst) in ms: P1 (0, 6), P2 (2, 5), P3 (4, 2), P4 (5, 8), P5 (7, 3). They are scheduled by non-preemptive Highest Response Ratio Next, where response ratio = (waiting time + burst) / burst. In what order do they run, and what is the average waiting time?
- A. P1, P3, P2, P5, P4; 6.2 ms
- B. P1, P3, P5, P2, P4; 4.6 ms
- C. P1, P2, P3, P5, P4; 5.8 ms
- D. P1, P3, P2, P5, P4; 5 ms
Correct answer: D. P1, P3, P2, P5, P4; 5 ms
At 6: ratios P2 (4 + 5)/5 = 1.8, P3 (2 + 2)/2 = 2, P4 (1 + 8)/8 = 1.125, so P3 runs 6-8. At 8: P2 (6 + 5)/5 = 2.2, P4 (3 + 8)/8 = 1.375, P5 (1 + 3)/3 = 1.33, so P2 runs 8-13. At 13: P4 (8 + 8)/8 = 2, P5 (6 + 3)/3 = 3, so P5 runs 13-16 and P4 16-24. Waits 0, 6, 2, 11, 6: average 5 ms. Plain SJF would pick P5 over P2 at time 8 and give 4.6 ms; HRRN chooses P2 because it has already waited 6 ms, which is the aging HRRN is designed for.
More Operating Systems questions
- A multilevel feedback queue has Q0 (Round Robin, quantum 2), Q1 (Round Robin, quantum 4) and Q2 (FCFS). New processes enter Q0. A process…
- Three processes each run CPU burst, I/O burst, CPU burst (in ms): P1 arrives at 0 with 5, 4, 3; P2 arrives at 2 with 3, 6, 2; P3 arrives…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. With 4 frames, initially empty, how many page faults do FIFO, LRU and…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. Three frames, initially empty, are managed by the clock (second-chance)…
- Reference string: 2, 3, 4, 1, 2, 3, 1, 5, 2, 3, 4, 1, 5. How many page faults does FIFO give with 3 frames and with 4 frames, and LRU with…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. Three frames, initially empty, use LFU replacement: the victim is the…