Operating system time slicing in round robin scheduling

Round Robin (RR) is a CPU scheduling algorithm where each process is assigned a fixed time slot called a time slice (or time quantum). The CPU cycles through all ready processes in order, giving each one the time slice. If a process does not finish within its time slice, it is moved to the back of the queue and the next process gets the CPU.

This is one of the simplest and most widely used scheduling algorithms in operating systems, especially in time-sharing systems where fair CPU allocation is important.

How Round Robin Scheduling Works

The scheduler maintains a ready queue of processes. It picks the first process, runs it for the duration of the time slice (or until it finishes, whichever is shorter), then moves to the next process. If a process still has remaining burst time, it goes back to the end of the queue.

Round Robin ? Process Queue Rotation A B C D CPU Time Slice = 2 Ready Queue ? each process gets a fixed time slice If not finished, process goes back to the end of the queue

Example − Time Slice of 2 Units

Consider the following processes with their burst times −

Process Burst Time (units)
A 4
B 1
C 8
D 1

With a time slice of 2 units, the CPU executes processes in the following order −

Gantt Chart ? Round Robin (Time Slice = 2) A B C D A C C C 0 2 3 5 6 8 10 12 14 Total execution time = 14 units

Step-by-Step Execution

Time Process Runs For Remaining Burst Action
0-2 A 2 2 Back to queue
2-3 B 1 0 Completed
3-5 C 2 6 Back to queue
5-6 D 1 0 Completed
6-8 A 2 0 Completed
8-10 C 2 4 Back to queue
10-12 C 2 2 Back to queue
12-14 C 2 0 Completed

Process A completes in 8 units (at time 8), B completes at time 3, C completes at time 14, and D completes at time 6. The total CPU utilization spans 14 units.

Calculating Average Times

Process Burst Time Completion Time Turnaround Time Waiting Time
A 4 8 8 4
B 1 3 3 2
C 8 14 14 6
D 1 6 6 5

Average Turnaround Time = (8 + 3 + 14 + 6) / 4 = 7.75 units

Average Waiting Time = (4 + 2 + 6 + 5) / 4 = 4.25 units

Conclusion

Round Robin scheduling uses time slicing to give each process a fair share of CPU time. It is simple, prevents starvation, and works well for time-sharing systems. The choice of time slice is critical ? too small increases context-switching overhead, while too large makes it behave like First Come First Served (FCFS).

Updated on: 2026-03-17T08:35:56+05:30

459 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements