What is Round Robin Scheduling in Operating System? - Solution

No comments

Question:

What is Round Robin Scheduling in Operating System?

Solution:

The round-robin (RR) scheduling algorithm is designed especially for timesharing systems. It is similar to FCFS scheduling, but preemption is added to enable the system to switch between processes. A small unit of time, called a time quantum or time slice, is defined. A time quantum is generally fronc 10 to 100 milliseconds in length. The ready queue is treated as a circular queue.
The CPU scheduler goes around the ready queue, allocating the CPU to each process for a time interval of up to 1 time quantum.

The average waiting time under the RR policy is often long. Consider the following set of processes that arrive at time 0, with the length of the CPU burst given in milliseconds:

Process      Burst Time
P1              24
P2              3
P3              3

If we use a time quantum of 4 milliseconds, then process P1 gets the first 4 milliseconds. Since it requires another 20 milliseconds, it is preempted after the first time quantum, and the CPU is given to the next process in the queue, process P2 . Process P2 does not need 4 milliseconds, so it quits before its time quantum expires. The CPU is then given to the next process, process P3. Once each process has received 1 time quantum, the CPU is returned to process P1 for an additional time quantum.



What is Round Robin Scheduling in Operating System? - Solution




The resulting RR schedule is as follows:



Let's calculate the average waiting time for the above schedule. P1 waits for 6 milliseconds (10- 4), P2 waits for 4 milliseconds, and P3 waits for 7 milliseconds.

Thus, the average waiting time is 17/3 = 5.66 milliseconds.



Tags:
What is Round Robin Scheduling in Operating System? - Solution, What is Round Robin Scheduling in Operating System, Round Robin scheduling CPU, Round Robin scheduling, average waiting time in Round Robin Scheduling


No comments :

Post a Comment