Skip to content
Learnearn.uk » IB Computer Science » Round Robin Scheduling

Round Robin Scheduling

Introduction

Round Robin Scheduling

Round Robin scheduling is a preemptive algorithm where each process is assigned a fixed time slice or quantum, and the CPU scheduler rotates among the processes, allowing each to execute for a predefined time interval.

If a process doesn’t complete within its time slice, it’s preempted, and the scheduler moves to the next process in the queue.

It’s designed to allocate CPU time fairly to all processes in the system, regardless of their arrival time or execution characteristics.

Initialisation

Initialisation & Time Slicing

Initially, all processes in the system are placed in a ready queue.

Each process in the ready queue is assigned a fixed time quantum (also known as a time slice). This time quantum is the maximum amount of CPU time that a process can have before it’s preempted to allow another process to execute.

Execution

Execution & Preemption

The scheduler selects the process at the front of the ready queue and allocates it the CPU for its time quantum.

If the process completes its CPU time quantum before finishing, it’s preempted by the scheduler, and it’s placed at the end of the ready queue.

Queue Rotation

Queue Rotation & Loop Back

The scheduler moves to the next process in the ready queue and repeats the process.

This rotation continues until all processes have had a chance to execute or until a certain condition is met (such as all processes being completed or a specified time limit elapsing).

After each process has had its turn to execute, the scheduler loops back to the beginning of the ready queue, treating it as a circular queue.

Pros and Cons

Advantages of Round Robin Scheduling

Fairness
Round Robin ensures equal CPU time allocation among processes, promoting fairness in resource utilization.

Responsiveness
Provides quick response times for short tasks due to regular time slices.

Simplicity
Relatively easy to implement compared to other algorithms, involving a straightforward round-robin queue.

Predictability
Offers predictable behavior, ensuring each process receives CPU time within its allotted slice.

Disadvantages of Round Robin Scheduling

Overhead

Frequent context switches can introduce overhead, especially with smaller time slices.

Inefficiency with Varied Tasks

Short tasks may suffer from repeated interruptions, impacting efficiency.

Poor Long Task Performance

Long-running tasks may experience increased latency due to sharing CPU time.

Time Quantum Sensitivity

Performance depends heavily on the chosen time slice, affecting responsiveness and efficiency.

Resources