- 2073 Bhadra · 5+5 marks
Two processors: priority and RR (q=3)
Short answer
With two processors sharing one ready queue, preemptive priority yields average waiting time10.56 ms, average turnaround time17.22 ms; round robin (q=3) gives average waiting time14.33 ms, average turnaround time21 ms.
Assume the system having two processors of same configuration, schedule the following set of processes according to preemptive priority and round robin algorithm (Time quantum = 3) and calculate average waiting time and average turnaround time.
| Process | Arrive Time | CPU Time (ms) | priority |
|---|---|---|---|
| A | 0 | 12 | 1 |
| B | 2 | 8 | 2 |
| C | 5 | 7 | 4 |
| D | 3 | 9 | 3 |
| E | 4 | 6 | 2 |
| F | 8 | 5 | 1 |
| G | 7 | 7 | 3 |
| H | 3 | 4 | 4 |
| I | 4 | 2 | 3 |
Assumptions: both processors are identical and share one ready queue; a process may run on either processor; priority 1 is the highest; ties are broken by earlier arrival; context-switch time is zero. In round robin a process arriving at the same instant a quantum ends joins the queue before the preempted one.
1. Preemptive priority
At every instant the two highest-priority ready processes run on the two CPUs. A new process of higher priority preempts the lowest-priority running one. (A and F, both priority 1, hold the CPUs whenever present; F arrives at 8 and preempts B.)
CPU1
| A | B | D | H | C |
0 12 14 23 27 34
CPU2
| idle | B | F | E | I | G |
0 2 8 13 19 21 28
| Process | Arrival | Burst | Completion | Turnaround | Waiting |
|---|---|---|---|---|---|
| A | 0 | 12 | 12 | 12 | 0 |
| B | 2 | 8 | 14 | 12 | 4 |
| C | 5 | 7 | 34 | 29 | 22 |
| D | 3 | 9 | 23 | 20 | 11 |
| E | 4 | 6 | 19 | 15 | 9 |
| F | 8 | 5 | 13 | 5 | 0 |
| G | 7 | 7 | 28 | 21 | 14 |
| H | 3 | 4 | 27 | 24 | 20 |
| I | 4 | 2 | 21 | 17 | 15 |
Average waiting time = 95/9 = 10.56; average turnaround time = 155/9 = 17.22
2. Round Robin (q = 3)
Both CPUs take processes from the head of a single FIFO queue; each runs at most 3 ms and then goes to the tail.
CPU1
| A | D | A | I | C | D | F | E | B | G | A |
0 3 6 9 11 14 17 20 23 25 28 31
CPU2
| idle | B | H | E | B | G | H | A | C | D | F | C |
0 2 5 8 11 14 17 18 21 24 27 29 30
| G |
30 31
| Process | Arrival | Burst | Completion | Turnaround | Waiting |
|---|---|---|---|---|---|
| A | 0 | 12 | 31 | 31 | 19 |
| B | 2 | 8 | 25 | 23 | 15 |
| C | 5 | 7 | 30 | 25 | 18 |
| D | 3 | 9 | 27 | 24 | 15 |
| E | 4 | 6 | 23 | 19 | 13 |
| F | 8 | 5 | 29 | 21 | 16 |
| G | 7 | 7 | 31 | 24 | 17 |
| H | 3 | 4 | 18 | 15 | 11 |
| I | 4 | 2 | 11 | 7 | 5 |
Average waiting time = 129/9 = 14.33; average turnaround time = 189/9 = 21
Answer: Preemptive priority: AWT = 10.56 ms, ATAT = 17.22 ms. Round robin (q=3): AWT = 14.33 ms, ATAT = 21 ms.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- RR, preemptive priority, preemptive SJF · Operating System, chapter 2
- FCFS, SJF, Priority, RR Gantt; max AWT · Operating System, chapter 2
- HRRN and RR scheduling (q=4) · Operating System, chapter 2
- Preemptive priority and SRTF Gantt · Operating System, chapter 2
- FCFS, SJF, RR Gantt and turnaround · Operating System, chapter 2
- Avg turnaround: FCFS, RR, SJF, SRT, HRRN · 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 (9, 6, 3 ms, q=3) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (53, 17, 68, 24 ms) · Embedded System, chapter 6 · asked 4×