0% found this document useful (0 votes)
409 views15 pages

Round Robin

The document discusses Round Robin CPU scheduling. It explains that in Round Robin scheduling, the CPU is assigned to processes on a first-come, first-served basis for a fixed time quantum. After the time quantum expires, the running process is preempted and sent back to the ready queue, while the CPU is assigned to the next process. It provides advantages like good average response time and suitability for time-sharing systems. Disadvantages include potential starvation of large processes and performance dependence on the time quantum value. Two sample problems demonstrate calculating average waiting and turnaround times for given processes under Round Robin scheduling with a time quantum of 2 units.

Uploaded by

Sohaib Aijaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
409 views15 pages

Round Robin

The document discusses Round Robin CPU scheduling. It explains that in Round Robin scheduling, the CPU is assigned to processes on a first-come, first-served basis for a fixed time quantum. After the time quantum expires, the running process is preempted and sent back to the ready queue, while the CPU is assigned to the next process. It provides advantages like good average response time and suitability for time-sharing systems. Disadvantages include potential starvation of large processes and performance dependence on the time quantum value. Two sample problems demonstrate calculating average waiting and turnaround times for given processes under Round Robin scheduling with a time quantum of 2 units.

Uploaded by

Sohaib Aijaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

CPU Scheduling

Round Robin(RR)

1
Round Robin CPU Scheduling

 CPU is assigned to the process on the basis


of FCFS for a fixed amount of time.
 This fixed amount of time is called as time
quantum or time slice.
 After the time quantum expires, the running
process is preempted and sent to the ready
queue.
 Then, the processor is assigned to the next
arrived process.
 It is always preemptive in nature.
2
Round Robin CPU Scheduling
Advantages-

 It gives the best performance in terms of average response time.


 It is best suited for time sharing system, client server architecture and
interactive system.

Disadvantages-

 It leads to starvation for processes with larger burst time as they have to
repeat the cycle many times.
 Its performance heavily depends on time quantum.
 Priorities can not be set for the processes.

3
Problem-01:

 Consider the set of 5 processes whose arrival time and burst time
are given below-

 If the CPU scheduling policy is Round Robin with time quantum =


2 unit, calculate the average waiting time and average turn
around time.
4
Solution
Ready Queue:-
P5, P1, P2, P5, P4, P1, P3, P2, P1

Now, we know-
 Turn Around time = Exit time – Arrival time
 Waiting time = Turn Around time – Burst time

5
Solution

Now,
 Average Turn Around time = (13 + 11 + 3 + 6 + 10) / 5 = 43 / 5 = 8.6 unit
 Average waiting time = (8 + 8 + 2 + 4 + 7) / 5 = 29 / 5 = 5.8 unit

6
Problem-02:

 Consider the set of 6 processes whose arrival time and burst time
are given below-

 If the CPU scheduling policy is Round Robin with time quantum =


2 unit, calculate the average waiting time and average turn
around time.
7
Solution
Ready Queue:-
P5, P6, P2, P5, P6, P2, P5, P4, P1, P3, P2, P1

Now, we know-
 Turn Around time = Exit time – Arrival time
 Waiting time = Turn Around time – Burst time

8
Solution

Now,
 Average Turn Around time = (8 + 17 + 4 + 6 + 17 + 13) / 6 = 65 / 6 =
10.84 unit
 Average waiting time = (4 + 12 + 2 + 5 + 11 + 10) / 6 = 44 / 6 = 7.33 unit

9
Priority Scheduling

 Out of all the available processes, CPU is


assigned to the process having the highest
priority.
 In case of a tie, it is broken by FCFS Scheduling.
 Priority Scheduling can be used in both
preemptive and non-preemptive mode.

10
Priority Scheduling
Advantages-
 It considers the priority of the processes and allows the important
processes to run first.
 Priority scheduling in preemptive mode is best suited for real time
operating system.

Disadvantages-
 Processes with lesser priority may starve for CPU.
 There is no idea of response time and waiting time.

11
Priority Scheduling
Note-01:
 The waiting time for the process having the highest priority will always
be zero in preemptive mode.
 The waiting time for the process having the highest priority may not be
zero in non-preemptive mode.

Note-02:

Priority scheduling in preemptive and non-preemptive mode behaves


exactly same under following conditions-
 The arrival time of all the processes is same
 All the processes become available

12
Problem-01:

 Consider the set of 5 processes whose arrival time and burst time
are given below-

 If the CPU scheduling policy is priority non-preemptive, calculate


the average waiting time and average turn around time. (Higher
number represents higher priority)

13
Solution

Now, we know-
 Turn Around time = Exit time – Arrival time
 Waiting time = Turn Around time – Burst time

14
Solution

Now, we know-
 Average Turn Around time = (4 + 14 + 10 + 6 + 7) / 5 = 41 / 5 =
8.2 unit
 Average waiting time = (0 + 11 + 9 + 1 + 5) / 5 = 26 / 5 = 5.2 unit

15

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy