- 2072 Asoj · 5 marks
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.
| Process | Arrival Time | CPU Time (ms) |
|---|---|---|
| A | 0 | 12 |
| B | 2 | 8 |
| C | 5 | 7 |
| D | 10 | 9 |
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
| Process | Arrival | Burst | Completion | Turnaround | Waiting |
|---|---|---|---|---|---|
| A | 0 | 12 | 12 | 12 | 0 |
| B | 2 | 8 | 20 | 18 | 10 |
| C | 5 | 7 | 27 | 22 | 15 |
| D | 10 | 9 | 36 | 26 | 17 |
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
| Process | Arrival | Burst | Completion | Turnaround | Waiting |
|---|---|---|---|---|---|
| A | 0 | 12 | 28 | 28 | 16 |
| B | 2 | 8 | 20 | 18 | 10 |
| C | 5 | 7 | 31 | 26 | 19 |
| D | 10 | 9 | 36 | 26 | 17 |
Average waiting time = 62/4 = 15.5; average turnaround time = 98/4 = 24.5
Comparison
| Algorithm | Average waiting time (ms) | Average turnaround time (ms) |
|---|---|---|
| HRRN | 10.5 | 19.5 |
| Round Robin (q=4) | 15.5 | 24.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)
Related questions
- Avg turnaround: FCFS, RR, SJF, SRT, HRRN · Operating System, chapter 2
- Two processors: priority and RR (q=3) · Operating System, chapter 2
- CPU criteria; RR Gantt and times · Operating System, chapter 2
- FCFS, SJF, RR Gantt and turnaround · Operating System, chapter 2
- FCFS, SJF, Priority, RR Gantt; max AWT · Operating System, chapter 2
- RR, preemptive priority, preemptive SJF · Operating System, chapter 2
- Round robin scheduling (9, 6, 3 ms, q=2) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (6, 4, 2 ms, q=2) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (53, 17, 68, 24 ms) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (9, 6, 3 ms, q=3) · Embedded System, chapter 6 · asked 4×