CoursifyCoursify

Round Robin Scheduling Analysis for Five Processes with Time Quantum 3 ms

Round Robin Scheduling Analysis for Five Processes with Time Quantum 3 ms

Verified Sources
May 27, 2026

Round Robin CPU scheduling is designed for fairness: each ready process receives at most one time quantum per turn before the scheduler rotates to the next ready task.2 For standard performance analysis, we use:

Turnaround Time (TAT)=Completion Time (CT)Arrival Time (AT)\text{Turnaround Time (TAT)} = \text{Completion Time (CT)} - \text{Arrival Time (AT)}

Waiting Time (WT)=Turnaround Time (TAT)Burst Time (BT)\text{Waiting Time (WT)} = \text{Turnaround Time (TAT)} - \text{Burst Time (BT)}

These formulas are widely used in operating-systems scheduling analysis.2

We are given the following processes and a quantum of 3 ms3 \text{ ms}:

ProcessArrival Time (AT)CPU Burst Time (BT)
P1012
P2010
P314
P4410
P5212

A careful ready queue simulation is necessary because new arrivals during a quantum are appended to the queue, and unfinished processes are re-enqueued after their slice expires.2

Footnotes

  1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. 2 3

  2. Relative Time Quantum-based Enhancements in Round Robin Scheduling - Discusses RR scheduling and key evaluation metrics such as waiting time and turnaround time.

  3. What is Burst time, Arrival time, Exit time, Response time, Waiting time, Turnaround time, and Throughput? - AfterAcademy - Gives standard definitions of waiting time and turnaround time.

  4. Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times.

Round Robin Scheduling - Solved Problem

Key Scheduling Rule Used

When a process uses its full 3 ms3 \text{ ms} quantum and is not finished, it is moved to the end of the ready queue. Processes arriving during that interval are inserted into the queue as they arrive.2

Footnotes

  1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

  2. Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times.

Round Robin Execution Walkthrough

  1. 1
    Step 1

    At t=0t=0, both P1 and P2 have arrived, so the initial ready queue is [P1,P2][P1, P2]. The scheduler selects the front process first.

    Footnotes

    1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

  2. 2
    Step 2

    P1 runs for one full quantum, reducing its remaining burst from 1212 to 99. During this interval, P3 arrives at t=1t=1 and P5 arrives at t=2t=2. After P1 is preempted, it is appended to the rear. Queue becomes [P2,P3,P5,P1][P2, P3, P5, P1].2

    Footnotes

    1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

    2. Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times.

  3. 3
    Step 3

    P2 runs for 3 ms3 \text{ ms}, so its remaining burst becomes 77. During this interval, P4 arrives at t=4t=4. After preemption, queue becomes [P3,P5,P1,P4,P2][P3, P5, P1, P4, P2].2

    Footnotes

    1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

    2. Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times.

  4. 4
    Step 4

    P3 runs for 3 ms3 \text{ ms} and has 1 ms1 \text{ ms} remaining. It is re-enqueued. Queue becomes [P5,P1,P4,P2,P3][P5, P1, P4, P2, P3].

  5. 5
    Step 5

    P5 uses one quantum and its remaining burst decreases from 1212 to 99. Queue becomes [P1,P4,P2,P3,P5][P1, P4, P2, P3, P5].

  6. 6
    Step 6

    P1 runs again for 3 ms3 \text{ ms}, reducing its remaining burst from 99 to 66. Queue becomes [P4,P2,P3,P5,P1][P4, P2, P3, P5, P1].

  7. 7
    Step 7

    P4 runs for 3 ms3 \text{ ms} and its remaining burst becomes 77. Queue becomes [P2,P3,P5,P1,P4][P2, P3, P5, P1, P4].

  8. 8
    Step 8

    P2 runs for another quantum and its remaining burst becomes 44. Queue becomes [P3,P5,P1,P4,P2][P3, P5, P1, P4, P2].

  9. 9
    Step 9

    P3 needs only 1 ms1 \text{ ms} more, so it finishes at t=22t=22. Queue becomes [P5,P1,P4,P2][P5, P1, P4, P2].

  10. 10
    Step 10

    P5 runs for 3 ms3 \text{ ms} and its remaining burst becomes 66. Queue becomes [P1,P4,P2,P5][P1, P4, P2, P5].

  11. 11
    Step 11

    P1 runs for 3 ms3 \text{ ms} and its remaining burst becomes 33. Queue becomes [P4,P2,P5,P1][P4, P2, P5, P1].

  12. 12
    Step 12

    P4 runs for 3 ms3 \text{ ms} and its remaining burst becomes 44. Queue becomes [P2,P5,P1,P4][P2, P5, P1, P4].

  13. 13
    Step 13

    P2 runs for 3 ms3 \text{ ms} and its remaining burst becomes 11. Queue becomes [P5,P1,P4,P2][P5, P1, P4, P2].

  14. 14
    Step 14

    P5 runs for 3 ms3 \text{ ms} and its remaining burst becomes 33. Queue becomes [P1,P4,P2,P5][P1, P4, P2, P5].

  15. 15
    Step 15

    P1 uses its last 3 ms3 \text{ ms} and completes at t=40t=40. Queue becomes [P4,P2,P5][P4, P2, P5].

  16. 16
    Step 16

    P4 runs for 3 ms3 \text{ ms} and its remaining burst becomes 11. Queue becomes [P2,P5,P4][P2, P5, P4].

  17. 17
    Step 17

    P2 finishes its final 1 ms1 \text{ ms} at t=44t=44. Queue becomes [P5,P4][P5, P4].

  18. 18
    Step 18

    P5 uses its final 3 ms3 \text{ ms} and completes at t=47t=47. Queue becomes [P4][P4].

  19. 19
    Step 19

    P4 finishes its last 1 ms1 \text{ ms} at t=48t=48. All processes are complete.

The resulting Gantt chart is:

For clarity, the same schedule can be written linearly as:

IntervalRunning Process
030-3P1
363-6P2
696-9P3
9129-12P5
121512-15P1
151815-18P4
182118-21P2
212221-22P3
222522-25P5
252825-28P1
283128-31P4
313431-34P2
343734-37P5
374037-40P1
404340-43P4
434443-44P2
444744-47P5
474847-48P4

This schedule follows the standard RR rule that each ready process receives up to one quantum in FIFO queue order before the next cycle begins.2

Footnotes

  1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

  2. Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times.

Fast Way to Compute Waiting Time

In RR problems, first compute each completion time from the Gantt chart. Then use TAT=CTAT\text{TAT} = \text{CT} - \text{AT} and WT=TATBT\text{WT} = \text{TAT} - \text{BT} instead of summing many scattered waiting intervals.2

Footnotes

  1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

  2. What is Burst time, Arrival time, Exit time, Response time, Waiting time, Turnaround time, and Throughput? - AfterAcademy - Gives standard definitions of waiting time and turnaround time.

From the Gantt chart, the completion time values are:

  • P1 completes at 4040
  • P2 completes at 4444
  • P3 completes at 2222
  • P4 completes at 4848
  • P5 completes at 4747

Now compute turnaround time and waiting time:

ProcessATBTCTTAT =CTAT=CT-ATWT =TATBT=TAT-BT
P101240400=4040-0=404012=2840-12=28
P201044440=4444-0=444410=3444-10=34
P31422221=2122-1=21214=1721-4=17
P441048484=4448-4=444410=3444-10=34
P521247472=4547-2=454512=3345-12=33

Therefore,

Average Waiting Time=28+34+17+34+335=1465=29.2 ms\text{Average Waiting Time} = \frac{28+34+17+34+33}{5} = \frac{146}{5} = 29.2 \text{ ms}

Average Turnaround Time=40+44+21+44+455=1945=38.8 ms\text{Average Turnaround Time} = \frac{40+44+21+44+45}{5} = \frac{194}{5} = 38.8 \text{ ms}

So the final answers are:

  • Average waiting time = 29.2 ms29.2 \text{ ms}
  • Average turn-around time = 38.8 ms38.8 \text{ ms}

These metrics match the standard operating-systems definitions for RR scheduling analysis.2

Footnotes

  1. Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples.

  2. What is Burst time, Arrival time, Exit time, Response time, Waiting time, Turnaround time, and Throughput? - AfterAcademy - Gives standard definitions of waiting time and turnaround time.

Waiting Time and Turnaround Time by Process

Comparison of per-process scheduling metrics under RR with quantum 3 ms3 \text{ ms}

Round Robin Scheduling Roadmap for This Problem

List arrivals and bursts

Phase 1

Record each process with its arrival time and CPU burst so the ready queue can be simulated correctly."

Apply the $3 \text{ ms}$ quantum

Phase 2

Run each selected process for at most 3 ms3 \text{ ms}; if unfinished, append it to the rear of the ready queue."

Build the Gantt chart

Phase 3

Track every CPU interval from t=0t=0 until all remaining burst times become 00."

Extract completion times

Phase 4

Read the finishing instant for each process directly from the final Gantt chart."

Compute TAT and WT

Phase 5

Use TAT=CTAT\text{TAT}=\text{CT}-\text{AT} and WT=TATBT\text{WT}=\text{TAT}-\text{BT}, then average the results."

Common Doubts and Edge Cases

Gantt chart: 0033 P1, 3366 P2, 6699 P3, 991212 P5, 12121515 P1, 15151818 P4, 18182121 P2, 21212222 P3, 22222525 P5, 25252828 P1, 28283131 P4, 31313434 P2, 34343737 P5, 37374040 P1, 40404343 P4, 43434444 P2, 44444747 P5, 47474848 P4. Average waiting time =29.2 ms=29.2 \text{ ms}, average turn-around time =38.8 ms=38.8 \text{ ms}.

Knowledge Check

Question 1 of 5
Q1Single choice

In Round Robin scheduling, what happens when a process uses its full quantum and still has remaining burst time?

Explore Related Topics

1

CPU Scheduling Case Study: FCFS vs SJF for a Five-Process Workload

The case study compares FCFS and non‑preemptive SJF scheduling for five processes that all arrive at time 0, showing their Gantt charts, individual waiting times, and average waiting times.

  • FCFS order A → B → C → D → E; waiting times 0, 10, 11, 13, 14 ms; average 9.69.6 ms.
  • SJF order B → D → C → E → A (ties broken by arrival order); waiting times 0, 1, 2, 4, 9 ms; average 3.23.2 ms.
  • With simultaneous arrivals, each process’s waiting time equals the sum of burst times of all jobs scheduled before it.
  • Non‑preemptive SJF is optimal for minimizing average waiting time when burst lengths are known.
  • The priority column is irrelevant for this comparison.
2

Banker's Algorithm Safe-State Analysis for Processes $P_0$ Through $P_4$

The course walks through a full Banker's‑algorithm safety analysis for processes P0P_0P4P_4, computing the Need matrix and using the work‑vector test to verify a safe state and a valid completion order.

  • Need matrix: P0  (0,0,0,0)P_0\;(0,0,0,0), P1  (0,7,5,0)P_1\;(0,7,5,0), P2  (1,0,0,2)P_2\;(1,0,0,2), P3  (0,0,2,0)P_3\;(0,0,2,0), P4  (0,6,4,2)P_4\;(0,6,4,2).
  • Starting work Work=Available=(1,5,2,0)Work = Available = (1,5,2,0); each step selects a process with NeedWorkNeed \le Work, releases its allocation, and updates WorkWork.
  • All processes finish, yielding a safe sequence P0,P2,P1,P3,P4\langle P_0, P_2, P_1, P_3, P_4\rangle.
  • A safe state requires only one such sequence; it does not mean every immediate allocation is safe.
  • Exam tip: test processes with minimal or zero Need first to unlock the rest.
3

Matrix Chain Multiplication with Dynamic Programming: Optimal Parenthesization for $\{4,10,3,12,20,7\}$

The lesson shows how dynamic programming determines the cheapest way to multiply the matrix chain with dimensions {4,10,3,12,20,7}\{4,10,3,12,20,7\}.

  • The recurrence m[i,j]=minik<j(m[i,k]+m[k+1,j]+pi1pkpj)m[i,j]=\min_{i\le k<j}\big(m[i,k]+m[k+1,j]+p_{i-1}p_kp_j\big) with m[i,i]=0m[i,i]=0 computes optimal sub‑costs.
  • Filling the cost table yields m[1,5]=1344m[1,5]=1344, and the split table gives the top‑level split k=2k=2.
  • The optimal parenthesization is (A1A2)((A3A4)A5)(A_1A_2)\big((A_3A_4)A_5\big), requiring 120+720+420+84=1344120+720+420+84=1344 scalar multiplications.
  • The bottom‑up algorithm runs in O(n3)O(n^3) time and uses O(n2)O(n^2) space.
Chat with Kiro