##### Round Robin(RR) Scheduling

RR Scheduling-

• A fixed time is allotted to each process, called quantum, for execution.
• Once a process is executed for given time period that process is preemptied and other process executes for given time period.
• Context switching is used to save states of preemptied processes.

example- ##### Round Robin(RR) Process Scheduling Algorithm

Round Robin(RR) Process Scheduling Algorithm: This is preemptive version of FCFS algorithm based on time quantum.  Very large time quantum makes Round Robin as FCFS algorithm. It minimizes average response time. It has circular queue to hold processes to be executed next.

Example: Consider the following table:

 Process no. Arrival Time Burst Time P1 0 6 P2 2 1 P3 4 4 P4 5 3

Find the average waiting time and average turn arround time using RR(Round Robin) algorithm with Time Quantum size 2?

Solution: Using round robin algorithm with time quantum size  2, ready queue and gantt chart are:

Ready Queue: P1, P2, P1, P3, P1, P4, P3, P4

Gantt chart is: Therefore,

 Waiting Time Turn around Time Completion Time Process No. Arrival Time Burst Time 9 - 6 = 3 9 - 0 = 9 9 P1 0 6 1 - 1 = 0 3 - 2 = 1 3 P2 2 1 8 - 4 = 4 13 - 5 = 8 13 P3 5 4 8 - 3 = 5 14 - 6 = 8 14 P4 6 3

So,
Average Turn arround time  = (9 + 1 + 8 + 8) / (4) = 6.5

Average Waiting time = (3 + 0 + 4 + 5) / (4) = 3