Skip to main content

Round robin scheduling (9, 6, 3 ms, q=2)

Short answer

Round-robin with time slice 2 ms yields waiting times: P1 9, P2 9, P3 8 ms; average waiting time = 8.67 ms, average turnaround time = 14.67 ms.

Consider three processes with process IDs P1, P2, P3 with estimated completion time 9, 6, 3 ms respectively, enters the ready queue together in order P1, P2, P3. Calculate Waiting Time and Turn Around Time for each process and average waiting time and average turn around time in RR (Round-Robin) algorithm with time slice 2 ms. Assume there is no I/O waiting for the process.

Round robin gives each process the CPU for at most one time slice (2 ms), then moves it to the back of the ready queue. All processes arrive at 0 in the order P1, P2, P3.

Gantt chart

| P1 | P2 | P3 | P1 | P2 | P3 | P1 | P2 | P1 | P1 |
0    2    4    6    8    10   11   13   15   17   18

Remaining time after each slice

  • 0-2 P1 (7 left), 2-4 P2 (4 left), 4-6 P3 (1 left)
  • 6-8 P1 (5), 8-10 P2 (2), 10-11 P3 (done)
  • 11-13 P1 (3), 13-15 P2 (done), 15-17 P1 (1), 17-18 P1 (done)

Calculation

TAT = completion time - arrival time; WT = TAT - burst time.

ProcessATBTCTTAT = CT - ATWT = TAT - BT
P10918189
P20615159
P30311118

AWT = (9 + 9 + 8) / 3 = 26/3 = 8.67 ms

ATAT = (18 + 15 + 11) / 3 = 44/3 = 14.67 ms

Answer: AWT = 8.67 ms, ATAT = 14.67 ms.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 6 questions →