9.7.25

Round Robin Scheduling Algorithm

Round Robin Scheduling Algorithm

What is Round Robin Scheduling?

Round Robin Scheduling is a time-sharing scheduling algorithm that allocates a fixed time slice (called a time quantum) to each process in the ready queue.

How Round Robin Scheduling Works

  • Each process is assigned a fixed time slice (time quantum).
  • The CPU executes each process for the time quantum.
  • If the process completes its execution within the time quantum, it is terminated.
  • If the process does not complete its execution within the time quantum, it is preempted and moved to the end of the ready queue.

Example Calculation

Suppose we have the following processes with their arrival times and burst times:

Process Arrival Time Burst Time
P1 0 5
P2 1 3
P3 2 4

Let's assume a time quantum of 2 units.

Gantt Chart

Time Process
0-2 P1
2-3 P2
3-4 P3
4-6 P1
6-7 P2
7-9 P3
9-10 P1
10-11 P3

Calculation of Waiting Time and Turnaround Time

Process Arrival Time Burst Time Completion Time Turnaround Time Waiting Time
P1 0 5 10 10 5
P2 1 3 7 6 3
P3 2 4 11 9 5

Average Waiting Time and Turnaround Time

Average Waiting Time = (5 + 3 + 5) / 3 = 13 / 3 = 4.33

Average Turnaround Time = (10 + 6 + 9) / 3 = 25 / 3 = 8.33

No comments:

Post a Comment

Difference between File and Folder

10 Differences Between Files and Folders Definition: File: A collection of data or information stored on a computer. ...