Consider the following set of processes with the arrival time and length of…
2025
Consider the following set of processes with the arrival time and length of CPU Burst time given in milli-seconds (ms):
Process | Arrival Time | Burst Time |
P₁ | 0 | 5 |
P₂ | 2 | 3 |
P₃ | 2 | 2 |
P₄ | 5 | 3 |
P₅ | 6 | 1 |
Find the average weighted turnaround time for these process
using Highest Response Ratio Next (HRN) Algorithm?
- A.
3.2 ms
- B.
2.834 ms
- C.
1.632 ms
- D.
6.721 ms
Attempted by 178 students.
Show answer & explanation
Correct answer: B
We use the non-preemptive Highest Response Ratio Next (HRN) scheduling algorithm.
For HRN, the response ratio (also called weighted turnaround ratio) for each ready process is:
Response ratio = (Waiting time + Burst time) / Burst time
At time 0, only P1 has arrived, so schedule P1 from 0 to 5.
At time 5, P2, P3, and P4 are ready. Compute response ratios:
P2: waiting = 5 − 2 = 3, ratio = (3 + 3) / 3 = 2.0
P3: waiting = 5 − 2 = 3, ratio = (3 + 2) / 2 = 2.5
P4: waiting = 5 − 5 = 0, ratio = (0 + 3) / 3 = 1.0
P3 has the highest ratio, so schedule P3 from 5 to 7.
At time 7, P2, P4, and P5 (arrived at time 6) are ready. Compute response ratios:
P2: waiting = 7 − 2 = 5, ratio = (5 + 3) / 3 ≈ 2.67
P4: waiting = 7 − 5 = 2, ratio = (2 + 3) / 3 ≈ 1.67
P5: waiting = 7 − 6 = 1, ratio = (1 + 1) / 1 = 2.0
P2 has the highest ratio, so schedule P2 from 7 to 10.
At time 10, P4 and P5 are ready. Compute response ratios:
P4: waiting = 10 − 5 = 5, ratio = (5 + 3) / 3 ≈ 2.67
P5: waiting = 10 − 6 = 4, ratio = (4 + 1) / 1 = 5.0
P5 has the highest ratio, so schedule P5 from 10 to 11, then schedule P4 from 11 to 14.
Final schedule (start → finish): P1: 0 → 5, P3: 5 → 7, P2: 7 → 10, P5: 10 → 11, P4: 11 → 14.
P1: arrival = 0, burst = 5, completion = 5 → waiting = 0, turnaround = 5, weighted turnaround = 5 / 5 = 1.0
P3: arrival = 2, burst = 2, completion = 7 → waiting = 5, turnaround = 5, weighted turnaround = 5 / 2 = 2.5
P2: arrival = 2, burst = 3, completion = 10 → waiting = 5, turnaround = 8, weighted turnaround = 8 / 3 ≈ 2.67
P5: arrival = 6, burst = 1, completion = 11 → waiting = 4, turnaround = 5, weighted turnaround = 5 / 1 = 5.0
P4: arrival = 5, burst = 3, completion = 14 → waiting = 6, turnaround = 9, weighted turnaround = 9 / 3 = 3.0
The average weighted turnaround time is the mean of these values:
(1.0 + 2.5 + 2.67 + 5.0 + 3.0) / 5 ≈ 14.17 / 5 ≈ 2.834 ms.
So, the average weighted turnaround time for these processes using HRN is approximately 2.834 ms.
A video solution is available for this question — log in and enroll to watch it.