Skip to main content

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.

ProcessArrive TimeCPU Time (ms)priority
A0121
B282
C574
D393
E462
F851
G773
H344
I423

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
ProcessArrivalBurstCompletionTurnaroundWaiting
A01212120
B2814124
C57342922
D39232011
E4619159
F851350
G77282114
H34272420
I42211715

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
ProcessArrivalBurstCompletionTurnaroundWaiting
A012313119
B28252315
C57302518
D39272415
E46231913
F85292116
G77312417
H34181511
I421175

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)

All Operating System chapter 2 questions →