Round Robin Scheduling Algorithm

For Complete YouTube Video: Click Here

In this class, we will try to understand Round Robin Scheduling Algorithm.

We have already made a detailed explanation of the First Come First Serve in our previous classes.

Round Robin Scheduling Algorithm

The concept of the Round Robin Scheduling Algorithm is similar to the First Come First Serve Scheduling Algorithm.

The primary difference between Round Robin Scheduling Algorithm and FCFS is FCFS is a non-preemptive algorithm, and round robin is a preemptive algorithm.

We assume the time quantum as two units in time.

At arrival time zero, we have process P1, and process P1 will get executed for two units in time and will get preempted.

Process P1 has two units of time left.

We have processes P2 and P3 in the ready pool after two units in time.

All the arrived processes will get stored in a queue in the round robin.

After two units of time, processes P2 and P3 are in the ready queue, and process P1 will get queued into the ready pool, as shown below.

Now process P2 will get switched into to running state.

Process P2 will get executed for two units in time and left with four units in time.

After four units, processes from P1 to P4 will be in the ready queue, and P2 will be placed at the end of the queue.

Now process P3 is at the start of the queue and will get switched into the running state.

As it has the burst time of one unit in time, it will get executed upto the fifth unit in time.

P3 has completed its execution, so we will not place it at the end of the queue.

After five units, all the processes have arrived, and we have process P1 at the start of the queue.

Now, process P1 will get switched into the running state, and it will complete its execution.

Now, P4 will be at the start of the queue and will get allocated for running.

As the burst time of P4 is two units in time, it will get executed.

P2 will get switched to the running state and has two units of burst time remaining.

Now, P5 will get switched to the running state and has five units of burst time remaining.

P2 will get switched to the running state and complete its execution.

As P5 is the only process left, it will get executed till the end.

Now we will compute the Completion Time based on the completion time in the Gantt Chart.

The Turn Around Times is calculated from the difference between the CT and AT.

Waiting Time is calculated from the difference between the TAT and BT as shown below.