Introduction
Round Robin scheduling is a preemptive CPU scheduling algorithm based on a fixed time quantum. Each ready process gets the CPU for at most one time quantum before the scheduler moves to the next process.
It is especially useful in time-sharing systems, where the goal is not just to finish jobs quickly, but to give every active process regular CPU attention.
Core Rule of Round Robin Scheduling
Round Robin uses a ready queue. The process at the head of the queue gets the CPU and runs for one fixed time quantum.
After the quantum ends, two things can happen:
If the process finishes: It leaves the system.
If the process still has remaining time: It is preempted and placed at the tail of the ready queue.
Because the CPU can forcibly stop a running process after its quantum, Round Robin needs preemption, timer interrupts, and context switching.
Time Quantum Tradeoff
The time quantum controls the behavior of Round Robin. A smaller quantum improves response time because processes get CPU turns more frequently.
However, a very small quantum causes too many context switches, which increases overhead. A very large quantum reduces overhead, but Round Robin starts behaving closer to FCFS because most processes may finish in one turn.
Round Robin Scheduling Example
Consider four processes with arrival time and burst time:
Process | Arrival Time | Burst Time |
|---|---|---|
P1 | 0 | 10 |
P2 | 1 | 5 |
P3 | 2 | 8 |
P4 | 3 | 4 |
Time Quantum = 4
Round Robin Scheduling Example
The compact execution flow is:
P1runs from0 to 4and still has remaining time.P2runs from4 to 8and still has remaining time.P3runs from8 to 12and still has remaining time.P4runs from12 to 16and finishes.P1runs again from16 to 20.P2runs from20 to 21and finishes.P3runs from21 to 25and finishes.P1runs from25 to 27and finishes.
Process | CPU Time Interval |
|---|---|
P1 | 0 to 4 |
P2 | 4 to 8 |
P3 | 8 to 12 |
P4 | 12 to 16 |
P1 | 16 to 20 |
P2 | 20 to 21 |
P3 | 21 to 25 |
P1 | 25 to 27 |
Metric Calculation
The main formulas are:
CT: time when a process finishes
TAT:
CT - ATWT:
TAT - BTRT:
first CPU start time - AT
Process | CT | TAT | WT | RT |
|---|---|---|---|---|
P1 | 27 | 27 | 17 | 0 |
P2 | 21 | 20 | 15 | 3 |
P3 | 25 | 23 | 15 | 6 |
P4 | 16 | 13 | 9 | 9 |
Average TAT = 20.75, average WT = 14.0, and average RT = 4.5.
Strengths and Weaknesses of Round Robin
Strengths | Weaknesses |
|---|---|
Gives good response time | May increase turnaround time |
Shares CPU fairly among ready processes | Small quantum causes many context switches |
Works well for time-sharing systems | Large quantum behaves close to FCFS |
Summary
Round Robin scheduling gives each ready process the CPU for at most one fixed time quantum. If the process finishes, it exits; otherwise, it is preempted and placed at the end of the ready queue.
It is fair, simple, and useful for time-sharing systems. Its main tradeoff is quantum selection: a small quantum improves response time but increases context-switching overhead, while a large quantum makes the algorithm behave closer to FCFS.
Be the first to add a comment.