Round Robin Scheduling
Round robin is the scheduling algorithm used by the CPU during execution of the
process . Round robin is designed specifically for time sharing systems. It is similar
to first come first serve scheduling algorithm but the preemption is the added
functionality to switch between the processes.
It is one of the oldest, simplest, fairest and most widely used scheduling
algorithms, designed especially for time-sharing systems. A small unit of time, called
timeslice or quantum, is defined. All runnable processes are kept in a circular queue.
The CPU scheduler goes around this queue, allocating the CPU to each process for a time
interval of one quantum. New processes are added to the tail of the queue.
The CPU scheduler picks the first process from the queue, sets a timer to interrupt
after one quantum, and dispatches the process.
If the process is still running at the end of the quantum, the CPU is preempted and
the process is added to the tail of the queue. If the process finishes before the end of the
quantum, the process itself releases the CPU voluntarily. In either case, the CPU
scheduler assigns the CPU to the next process in the ready queue. Every time a process is
granted the CPU, a context switch occurs, which adds overhead to the process execution
time.