Skip to main content

HRRN and RR scheduling (q=4)

Short answer

For HRRN, average waiting time is 10.5 ms and average turnaround time is 19.5 ms. For Round Robin (q=4), average waiting time is 15.5 ms and average turnaround time is 24.5 ms.

Schedule the following set of processes according to HRRN and Round Robin algorithm (Time quantum=4) and calculate average waiting time and average turnaround time.

ProcessArrival TimeCPU Time (ms)
A012
B28
C57
D109

Waiting time = turnaround time − CPU time; turnaround = completion − arrival. For HRRN: response ratio = (waiting time + CPU time) / CPU time; after each completion the process with the highest ratio runs.

HRRN

  • t = 0: only A is present, so A runs 0-12.
  • t = 12: B ratio = (10+8)/8 = 2.25, C = (7+7)/7 = 2.0, D = (2+9)/9 = 1.22, so B runs 12-20.
  • t = 20: C = (15+7)/7 = 3.14, D = (10+9)/9 = 2.11, so C runs 20-27, then D runs 27-36.

HRRN (non-preemptive)

| A | B | C | D |
0   12  20  27  36
ProcessArrivalBurstCompletionTurnaroundWaiting
A01212120
B28201810
C57272215
D109362617

Average waiting time = 42/4 = 10.5; average turnaround time = 78/4 = 19.5

Round Robin (q = 4)

A runs first; new arrivals join the ready queue ahead of a preempted process. Queue order of execution: A, B, A, C, B, D, A, C, D.

Round Robin (q = 4)

| A | B | A | C | B | D | A | C | D |
0   4   8   12  16  20  24  28  31  36
ProcessArrivalBurstCompletionTurnaroundWaiting
A012282816
B28201810
C57312619
D109362617

Average waiting time = 62/4 = 15.5; average turnaround time = 98/4 = 24.5

Comparison

AlgorithmAverage waiting time (ms)Average turnaround time (ms)
HRRN10.519.5
Round Robin (q=4)15.524.5

Answer: HRRN: AWT = 10.5 ms, ATAT = 19.5 ms. RR: AWT = 15.5 ms, ATAT = 24.5 ms.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 2 questions →