Round Robin Scheduling Analysis for Five Processes with Time Quantum 3 ms
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:
These formulas are widely used in operating-systems scheduling analysis.2
We are given the following processes and a quantum of :
| Process | Arrival Time (AT) | CPU Burst Time (BT) |
|---|---|---|
| P1 | 0 | 12 |
| P2 | 0 | 10 |
| P3 | 1 | 4 |
| P4 | 4 | 10 |
| P5 | 2 | 12 |
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
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩ ↩2 ↩3
-
Relative Time Quantum-based Enhancements in Round Robin Scheduling - Discusses RR scheduling and key evaluation metrics such as waiting time and turnaround time. ↩
-
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. ↩
-
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 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
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times. ↩
Round Robin Execution Walkthrough
- 1Step 1
At , both P1 and P2 have arrived, so the initial ready queue is . The scheduler selects the front process first.
Footnotes
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
- 2Step 2
P1 runs for one full quantum, reducing its remaining burst from to . During this interval, P3 arrives at and P5 arrives at . After P1 is preempted, it is appended to the rear. Queue becomes .2
Footnotes
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times. ↩
-
- 3Step 3
P2 runs for , so its remaining burst becomes . During this interval, P4 arrives at . After preemption, queue becomes .2
Footnotes
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
Round Robin Scheduling with different arrival times - Tutorialspoint - Illustrates queue updates and RR execution when processes arrive at different times. ↩
-
- 4Step 4
P3 runs for and has remaining. It is re-enqueued. Queue becomes .
- 5Step 5
P5 uses one quantum and its remaining burst decreases from to . Queue becomes .
- 6Step 6
P1 runs again for , reducing its remaining burst from to . Queue becomes .
- 7Step 7
P4 runs for and its remaining burst becomes . Queue becomes .
- 8Step 8
P2 runs for another quantum and its remaining burst becomes . Queue becomes .
- 9Step 9
P3 needs only more, so it finishes at . Queue becomes .
- 10Step 10
P5 runs for and its remaining burst becomes . Queue becomes .
- 11Step 11
P1 runs for and its remaining burst becomes . Queue becomes .
- 12Step 12
P4 runs for and its remaining burst becomes . Queue becomes .
- 13Step 13
P2 runs for and its remaining burst becomes . Queue becomes .
- 14Step 14
P5 runs for and its remaining burst becomes . Queue becomes .
- 15Step 15
P1 uses its last and completes at . Queue becomes .
- 16Step 16
P4 runs for and its remaining burst becomes . Queue becomes .
- 17Step 17
P2 finishes its final at . Queue becomes .
- 18Step 18
P5 uses its final and completes at . Queue becomes .
- 19Step 19
P4 finishes its last at . All processes are complete.
The resulting Gantt chart is:
For clarity, the same schedule can be written linearly as:
| Interval | Running Process |
|---|---|
| P1 | |
| P2 | |
| P3 | |
| P5 | |
| P1 | |
| P4 | |
| P2 | |
| P3 | |
| P5 | |
| P1 | |
| P4 | |
| P2 | |
| P5 | |
| P1 | |
| P4 | |
| P2 | |
| P5 | |
| P4 |
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
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
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 and instead of summing many scattered waiting intervals.2
Footnotes
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
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
- P2 completes at
- P3 completes at
- P4 completes at
- P5 completes at
Now compute turnaround time and waiting time:
| Process | AT | BT | CT | TAT | WT |
|---|---|---|---|---|---|
| P1 | 0 | 12 | 40 | ||
| P2 | 0 | 10 | 44 | ||
| P3 | 1 | 4 | 22 | ||
| P4 | 4 | 10 | 48 | ||
| P5 | 2 | 12 | 47 |
Therefore,
So the final answers are:
- Average waiting time =
- Average turn-around time =
These metrics match the standard operating-systems definitions for RR scheduling analysis.2
Footnotes
-
Round Robin Scheduling in Operating System - GeeksforGeeks - Defines RR behavior, formulas for turnaround and waiting time, and solved examples. ↩
-
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
Round Robin Scheduling Roadmap for This Problem
List arrivals and bursts
Phase 1Record each process with its arrival time and CPU burst so the ready queue can be simulated correctly."
Apply the $3 \text{ ms}$ quantum
Phase 2Run each selected process for at most ; if unfinished, append it to the rear of the ready queue."
Build the Gantt chart
Phase 3Track every CPU interval from until all remaining burst times become ."
Extract completion times
Phase 4Read the finishing instant for each process directly from the final Gantt chart."
Compute TAT and WT
Phase 5Use and , then average the results."
Common Doubts and Edge Cases
Gantt chart: – P1, – P2, – P3, – P5, – P1, – P4, – P2, – P3, – P5, – P1, – P4, – P2, – P5, – P1, – P4, – P2, – P5, – P4. Average waiting time , average turn-around time .
Knowledge Check
In Round Robin scheduling, what happens when a process uses its full quantum and still has remaining burst time?
Explore Related Topics
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 ms.
- SJF order B → D → C → E → A (ties broken by arrival order); waiting times 0, 1, 2, 4, 9 ms; average 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.
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 –, computing the Need matrix and using the work‑vector test to verify a safe state and a valid completion order.
- Need matrix: , , , , .
- Starting work ; each step selects a process with , releases its allocation, and updates .
- All processes finish, yielding a safe sequence .
- 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.
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 .
- The recurrence with computes optimal sub‑costs.
- Filling the cost table yields , and the split table gives the top‑level split .
- The optimal parenthesization is , requiring scalar multiplications.
- The bottom‑up algorithm runs in time and uses space.
