Skip to main content

Round robin scheduling (5, 8, 7 ms, q=2)

Short answer

Round-robin with time slice 2 ms gives waiting times: P1 8, P2 11, P3 13 ms; average waiting time = 10.67 ms, average turnaround time = 17.33 ms.

Three Processes P1, P2 and P3 with estimated completion time 5, 8, 7 ms respectively enters the ready queue together. Calculate WT, TAT for each process and calculate AWT and ATAT using Round Robin Pre-emptive scheduling algorithms with time slice of 2 ms.

Round robin (pre-emptive) with a time slice of 2 ms; all processes arrive at 0 in the order P1, P2, P3.

Gantt chart

| P1 | P2 | P3 | P1 | P2 | P3 | P1 | P2 | P3 | P2 | P3 |
0    2    4    6    8    10   12   13   15   17   19   20

Remaining time after each slice

  • Round 1: P1 0-2 (3 left), P2 2-4 (6 left), P3 4-6 (5 left)
  • Round 2: P1 6-8 (1 left), P2 8-10 (4 left), P3 10-12 (3 left)
  • Round 3: P1 12-13 (done), P2 13-15 (2 left), P3 15-17 (1 left)
  • Round 4: P2 17-19 (done), P3 19-20 (done)

Calculation

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

ProcessATBTCTTAT = CT - ATWT = TAT - BT
P10513138
P208191911
P307202013

AWT = (8 + 11 + 13) / 3 = 32/3 = 10.67 ms

ATAT = (13 + 19 + 20) / 3 = 52/3 = 17.33 ms

Answer: AWT = 10.67 ms, ATAT = 17.33 ms.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 6 questions →