0% found this document useful (0 votes)
9 views34 pages

Round Robin Concept

Round Robin is a CPU scheduling method that allocates a fixed time slice to each process in a rotating manner, promoting fairness among competing processes. It is characterized by its simplicity and responsiveness, making it suitable for time-sharing systems, but can suffer from high overhead and underutilization if the time quantum is not properly set. The algorithm involves processes being added to a queue, executed for a time quantum, and then either completing or being returned to the queue until all processes are finished.

Uploaded by

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

Round Robin Concept

Round Robin is a CPU scheduling method that allocates a fixed time slice to each process in a rotating manner, promoting fairness among competing processes. It is characterized by its simplicity and responsiveness, making it suitable for time-sharing systems, but can suffer from high overhead and underutilization if the time quantum is not properly set. The algorithm involves processes being added to a queue, executed for a time quantum, and then either completing or being returned to the queue until all processes are finished.

Uploaded by

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

Round Robin

Concept
BY: JONNIFER C MANDIGMA
SUBJECT PROFESSOR
What is Round Robin
• is a method used by operating systems
to manage the execution time of
multiple processes that are competing
for CPU attention. It is called "round
robin" because the system rotates
through all the processes, allocating
each of them a fixed time slice or
"quantum", regardless of their priority.
The primary goal of this scheduling method is to ensure that
all processes are given an equal opportunity to execute,
promoting fairness among tasks.

• Here's a simple breakdown:


• Process Arrival: Processes enter the system and are placed in a queue.

• Time Allocation: Each process is given a certain amount of CPU time,


called a quantum.

• Execution: The process uses the CPU for the allocated time.

• Rotation: If the process completes within the time, it leaves the system.
If not, it goes back to the end of the queue.

• Repeat: The CPU continues to cycle through the queue until all
processes are completed.
Characteristics of SJF Scheduling
How Does It Work? -
• Imagine you're at a busy restaurant with a group of
friends, and there's only one waiter. The waiter
could spend a long time at one table, but instead,
he choose to spend exactly one minute at each
table before moving to the next. Similarly, in Round
Robin Scheduling, the CPU spends a predetermined
slice of time on each process. If a process hasn't
finished its task by the time its slice is up, it's
moved to the back of the queue, and the CPU
moves on to the next process.
Advantages of Round Robin Scheduling

• Fairness: Each process gets an equal share of the CPU.

• Simplicity: The algorithm is straightforward and easy to


implement.

• Responsiveness: Round Robin can handle multiple


processes without significant delays, making it ideal for
time-sharing systems.
Disadvantages of Round Robin
Scheduling:
• Overhead: Switching between processes can lead to high
overhead, especially if the quantum is too small.

• Underutilization: If the quantum is too large, it can cause


the CPU to feel unresponsive as it waits for a process to
finish its time.
Characteristics of Round-Robin Scheduling
• Here are the important characteristics of Round-Robin Scheduling:
• Round robin is a pre-emptive algorithm
• The CPU is shifted to the next process after 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 needs to be processed. However, it may differ 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.
How does the Round Robin
Algorithm Work?
1.All the processes are added to the ready queue.
2.At first, The burst time of every process is compared to the time
quantum of the CPU.
3.If the burst time of the process is less than or equal to the time
quantum in the round-robin scheduling algorithm, the process is
executed to its burst time.
4.If the burst time of the process is greater than the time
quantum, the process is executed up to the time quantum (TQ).
5.When the time quantum expires, it checks if the process is
executed completely or not.
6.On completion, the process terminates. Otherwise, it goes back
again to the ready state.
• Consider the below flow diagram for a better understanding of
Scenario 1: Processes with Same Arrival Time
Consider the following table of arrival time and burst time for three processes P1, P2 and P3 and given Time
Quantum = 2 ms

Process Burst Time Arrival Time

P1 4 ms 0 ms

P2 5 ms 0 ms

P3 3 ms 0 ms
• Step-by-Step Execution:
1.Time 0-2 (P1): P1 runs for 2 ms (total time left: 2 ms).

2.Time 2-4 (P2): P2 runs for 2 ms (total time left: 3 ms).

3.Time 4-6 (P3): P3 runs for 2 ms (total time left: 1 ms).

4.Time 6-8 (P1): P1 finishes its last 2 ms.

5.Time 8-10 (P2): P2 runs for another 2 ms (total time left: 1 ms).

6.Time 10-11 (P3): P3 finishes its last 1 ms.

7.Time 11-12 (P2): P2 finishes its last 1 ms.


How to Compute Below Times in Round
Robin Using a Program?
•Completion Time: Time at which process
completes its execution.
•Turn Around Time: Time Difference between
completion time and arrival time. Turn Around
Time = Completion Time – Arrival Time
•Waiting Time(W.T): Time Difference between
turn around time and burst time.
Waiting Time = Turn Around Time – Burst
Time
How to Compute Below Times in Round
Robin Using a Program?
•Completion Time: Time at which process
completes its execution.
•Turn Around Time: Time Difference between
completion time and arrival time. Turn Around
Time = Completion Time – Arrival Time
•Waiting Time(W.T): Time Difference between
turn around time and burst time.
Waiting Time = Turn Around Time – Burst
Time
Turnaround
Completion Waiting Time
Process Time (CT –
Time (TAT – BT)
AT)

P1 17 17 10

P2 13 13 9

P3 20 20 11
EXAMPLE 2

Consider this following three processes

Process Queue Burst time

P1 4

P2 3

P3 5
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
Step 3) At time=4 , P2 is preempted and add at the end of the queue. P3 starts executing.
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
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
P2= 2+4= 6
P3= 4+3= 7

You might also like