Round Robin Scheduling Algorithm with Example [Link]
html
R o u n d R o b i n S c h e d u l i n g A l go r i t h m w i t h
Example
By : Lawrence Williams Updated November 4, 2023
W h at i s R o u n d - R o b i n
Scheduling?
The name of this algorithm
comes from the round-robin
principle, where each person
gets an equal share of
something in turns. It is the
oldest, simplest scheduling
algorithm, which is mostly used for multitasking.
In Round-robin scheduling, each ready task runs turn by turn only in a cyclic
queue for a limited time slice. This algorithm also o�ers starvation free execution
of processes.
Table of Content :
Characteristics of Round-Robin Scheduling
Here are the important characteristics of Round-Robin Scheduling:
• Round robin is a pre-emptive algorithm
• The CPU is shi�ed to the next process a�er fixed interval time, which is
called time quantum/time slice.
• The process that is preempted is added to the end of the queue.
• Round robin is a hybrid model which is clock-driven
• Time slice should be minimum, which is assigned for a specific task that
1 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
needs to be processed. However, it may di�er OS to OS.
• It is a real time algorithm which responds to the event within a specific time
limit.
• Round robin is one of the oldest, fairest, and easiest algorithm.
• Widely used scheduling method in traditional OS.
EXPLORE MORE
Learn Java Programming
with Beginners Tutorial
08:32
Linux Tutorial for
Beginners: Introduction to
02:13 35:04
Linux Operating System
01:35
What is Integration Testing
So�ware Testing Tutorial
Example of Round-robin Scheduling
Consider this following three processes
P r o ce s s Q u e u e B u r st t i m e
P1 4
P2 3
P3 5
2 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
Step 1) The execution begins with process P1, which has burst time 4. Here,
every process executes for 2 seconds. P2 and P3 are still in the waiting queue.
Step 2) At time =2, P1 is added to the end of the Queue and P2 starts executing
3 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
Step 3) At time=4 , P2 is preempted and add at the end of the queue. P3 starts
executing.
4 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
Step 4) At time=6 , P3 is preempted and add at the end of the queue. P1 starts
executing.
Step 5) At time=8 , P1 has a burst time of 4. It has completed execution. P2 starts
execution
5 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
Step 6) P2 has a burst time of 3. It has already executed for 2 interval. At time=9,
P2 completes execution. Then, P3 starts execution till it completes.
Step 7) Let’s calculate the average waiting time for above example.
Wait time
P1= 0+ 4= 4
6 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
P2= 2+4= 6
P3= 4+3= 7
A d v a n ta g e o f R o u n d - r o b i n S c h e d u l i n g
Here, are pros/benefits of Round-robin scheduling method:
• It doesn’t face the issues of starvation or convoy e�ect.
• All the jobs get a fair allocation of CPU.
• It deals with all process without any priority
• If you know the total number of processes on the run queue, then you can
also assume the worst-case response time for the same process.
• This scheduling method does not depend upon burst time. That’s why it is
easily implementable on the system.
• Once a process is executed for a specific set of the period, the process is
preempted, and another process executes for that given time period.
• Allows OS to use the Context switching method to save states of preempted
processes.
• It gives the best performance in terms of average response time.
D i s a d v a n ta g e s o f R o u n d - r o b i n S c h e d u l i n g
Here, are drawbacks/cons of using Round-robin scheduling:
7 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
• If slicing time of OS is low, the processor output will be reduced.
• This method spends more time on context switching
• Its performance heavily depends on time quantum.
• Priorities cannot be set for the processes.
• Round-robin scheduling doesn’t give special priority to more important
tasks.
• Decreases comprehension
• Lower time quantum results in higher the context switching overhead in the
system.
• Finding a correct time quantum is a quite di�icult task in this system.
W o r st C a s e L a t e n c y
This term is used for the maximum time taken for execution of all the tasks.
• dt = Denote detection time when a task is brought into the list
• st = Denote switching time from one task to another
• et = Denote task execution time
Fo r m u l a :
T
worst = {(dti+ sti + eti ), + (dti+ sti + eti )2 +...+ (dti+ sti + eti
)N., + (dti+ sti + eti + eti) N} + tISR
t,SR = sum of all execution times
Summar y
• The name of this algorithm comes from the round-robin principle, where
each person gets an equal share of something in turns.
• Round robin is one of the oldest, fairest, and easiest algorithms and widely
used scheduling methods in traditional OS.
• Round robin is a pre-emptive algorithm
• The biggest advantage of the round-robin scheduling method is that If you
know the total number of processes on the run queue, then you can also
8 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
assume the worst-case response time for the same process.
• This method spends more time on context switching
• Worst-case latency is a term used for the maximum time taken for the
execution of all the tasks.
You Might Like:
• I n t e r P r o ce s s C o m m u n i c a t i o n ( I P C ) i n O S
• P r o c e s s S y n c h r o n i za t i o n : C r i t i c a l S e c t i o n P r o b l e m i n O S
• Process Scheduling in OS: Long, Medium, Short Term Scheduler
•AbPoriuotrity Scheduling Algorithm: Preemptive, Non-Preemptive EXAMPLE
•About
SSD vUs s H D D : W h a t i s t h e D i � e r e n ce B e t w e e n S S D a n d H D D
Advertise with Us
Write For Us
Contact Us
Prev Report a Bug Next
C a r e e r S u g g e st i o n
SAP Career Suggestion Tool
So�ware Testing as a Career
I n t e r e st i n g
eBook
Blog
Quiz
SAP eBook
Execute online
Execute Java Online
Execute Javascript
Execute HTML
Execute Python
9 of 10 06/12/2023, 10:50 am
Round Robin Scheduling Algorithm with Example [Link]
English © Copyright - Guru99 2023 Privacy
10 of 10 06/12/2023, 10:50 am