---
title: "HRRN and RR scheduling (q=4)"
subject: "Operating System"
chapter: 2
key: "semester_6/operating_system:hrrn-rr-q4-awt-att"
source: https://www.bctengineer.com/q/semester_6/operating_system/hrrn-rr-q4-awt-att
site: BCT Engineering
---

# HRRN and RR scheduling (q=4)

Operating System · Chapter 2: Process Management

- Asked in: 2072 Asoj, 5 marks
- Video: [Highest Response Ratio Next Scheduling Algorithm | HRRN Scheduling Algorithm | Operating Systems](https://www.youtube.com/watch?v=xvRvdQ-Km8I) — Computer Science Plus
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/hrrn-rr-q4-awt-att
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-2

## Question

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 |

## 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.

## Answer

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)**

```text
| 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)**

```text
| 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.**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. At t=12, why does B run next under HRRN?
   A. B has the shortest burst
   B. B has the highest response ratio (10+8)/8 = 2.25
   C. B arrived first
   D. B has the highest priority
   Answer: B. HRRN picks the highest ratio: B 2.25 beats C 2.0 and D 1.22. (Key point: HRRN selection at t=12)

2. What are the HRRN average waiting and turnaround times?
   A. AWT 15.5, ATAT 24.5
   B. AWT 10.5, ATAT 19.5
   C. AWT 12, ATAT 20
   D. AWT 42, ATAT 78
   Answer: B. Waiting 0, 10, 15, 17 sum to 42 (10.5); turnaround 12, 18, 22, 26 sum to 78 (19.5). (Key point: HRRN averages)

3. Under RR with q=4 (new arrivals queue ahead of preempted process), what is the execution order?
   A. A, B, C, D, A, B, C, D, A
   B. A, B, A, C, B, D, A, C, D
   C. A, A, A, B, B, C, C, D, D
   D. A, B, C, A, D, B, C, D, A
   Answer: B. B (arrived at 2) and C (at 5) join the queue ahead of preempted A, giving A, B, A, C, B, D, A, C, D. (Key point: RR order)

4. Which algorithm gives the lower averages here?
   A. RR, with AWT 15.5
   B. HRRN, with AWT 10.5 and ATAT 19.5
   C. Both are equal
   D. RR, with ATAT 19.5
   Answer: B. HRRN's 10.5/19.5 beats RR's 15.5/24.5, since RR keeps splitting long jobs and delaying their completion. (Key point: Compare algorithms)

## Related in Operating System

- [Avg turnaround: FCFS, RR, SJF, SRT, HRRN](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Aavg-turnaround-fcfs-rr-sjf-srt-hrrn) — Operating System, chapter 2
- [Two processors: priority and RR (q=3)](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Atwo-processor-priority-rr-q3) — Operating System, chapter 2
- [CPU criteria; RR Gantt and times](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Acpu-criteria-rr-gantt) — Operating System, chapter 2
- [FCFS, SJF, RR Gantt and turnaround](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Afcfs-sjf-rr-q5-timeline) — Operating System, chapter 2
- [FCFS, SJF, Priority, RR Gantt; max AWT](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Ascheduling-gantt-fcfs-sjf-priority-rr-q2) — Operating System, chapter 2
- [RR, preemptive priority, preemptive SJF](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Aprocess-rr-priority-preemptive-sjf) — Operating System, chapter 2

## Related in other subjects

- [Round robin scheduling (9, 6, 3 ms, q=2)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-rr-9-6-3-q2) — Embedded System, chapter 6, asked 4×
- [Round robin scheduling (6, 4, 2 ms, q=2)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-rr-6-4-2-q2) — Embedded System, chapter 6, asked 4×
- [Round robin scheduling (53, 17, 68, 24 ms)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-rr-53-17-68-24-q4) — Embedded System, chapter 6, asked 4×
- [Round robin scheduling (9, 6, 3 ms, q=3)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-rr-9-6-3-q3) — Embedded System, chapter 6, asked 4×
