You are on page 1of 5

What is Round Robin Scheduling?

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 time-
slice or quantum, is defined. All 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
How It Works?

 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.
•Use a timer to cause an interrupt after a
predetermined time. Preempts if task exceeds it’s

•Train of events
Time slice occurs OR process suspends on
Put process on some queue and dispatch
Context Switch: Changing the processor
from running one task (or process) to
another. Implies changing memory.
Processor Sharing: Use of a small
quantum such that each process runs
frequently at speed 1/n.

•Choosing a time quantum

Too short - inordinate fraction of the time is

spent in context switches.

Too long - reschedule latency is too great. If

many processes want the CPU, then it's
a long time before a particular process
can get the CPU. This then acts like

Adjust so most processes won't use their

slice. As processors have become
faster, this is less of an issue.
Process Arrival Service
1 0 8
2 1 4
3 2 9
4 3 5

Round Robin , quantum = 4 , no priority-based


P1 P2 P3 P4 P1 P3 P4 P3

0 4 8 1 1 2 2 2 2
2 6 0 4 5 6

Average wait = ( (20-0) + (8-1) + (26-2) +