Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

Exploring Round Robin CPU

Scheduling
Advance Operating System (Mid Term Project)

Supervisor- Dr. Mohammad Rabiul Islam


GROUP MEMBERS

Student Name ID
Sabiba Tasnim Sameka 23-93092-3
Romona Magdalene Sarkar 24-93338-1
Fahim Faysal Sakib 24-93346-1
Md Sajjadul Islam Juel 23-93164-3
Tushar Md Asaduzzaman 23-93163-3
TOPICS TO BE COVERED

❑ Why use Round Robin


❑ What Is Scheduling in OS?
❑ Round Robin Example, Calculation
❑ Long term Scheduler VS Short term Scheduler
❑ Round Robin With Priority Scheduling Example,
❑ What is CPU Scheduling ?
Calculation
❑ CPU Scheduling Criteria
❑ Advantages
❑ CPU Scheduling Goals
❑ Limitations
❑ Types of CPU Scheduling
❑ Conclusion
❑ Round Robin CPU Scheduling
WHAT IS SCHEDULING?

► A process is a program in execution.


► Scheduling is the process of picking one process from
various processes and assigning it to the processor for
execution.
► The scheduler aids in completing this task.
LONG TERM SCHEDULER VS SHORT TERM SCHEDULER

Long Term Scheduler Short Term Scheduler


► Operating system scheduler that chooses ► Operating system scheduler that chooses
processes from the job queue . the process from the several processes
► Job pool that the processor runs.
► Slower than Short-term Scheduler ► Ready queue.
► Faster than Long-term Scheduler
WHAT IS CPU SCHEDULING ?

► The short-term scheduler also known as the CPU


scheduler.
► A method by which one process is allowed to use the CPU
while the other processes are kept on hold/in the waiting
state.
► As soon as the CPU becomes idle, the operating system
selects one of the processes that are in the ready queue,
waiting to be executed.
► The purpose of CPU scheduling in OS is to result in an
efficient, faster and fairer system.
CPU SCHEDULING CRITERIA

 CPU utilization – Keep the CPU as busy as possible


 Throughput – Number of processes that complete their
execution per unit of time.
 Turnaround Time – Amount of time to execute a particular
process
 Waiting Time – Amount of time a process has been waiting
in the ready queue
 Response Time – Amount of time it takes from when a
request was submitted until the first response is produced.
CPU SCHEDULING GOALS

❏ Utilization of CPU at maximum level. Keep CPU as busy as possible.

❏ Allocation of CPU should be fair.

❏ Throughput should be Maximum. i.e. Number of processes that complete their execution per time unit
should be maximized.

❏ Minimum waiting time.

❏ Minimum response time. It means that the time when a process produces the first response should be
as less as possible.
Types of CPU Scheduling

Two main types of CPU Scheduling

1. Non-preemptive Scheduling:
 CPU is allocated to the process until it terminates.
 No switching takes place.

2. Preemptive Scheduling
 Interrupts processes, forcing them to give control to other
processes.
 Provides better responsiveness.
 Tasks are switched based on priority.
Why use Round Robin?
Round Robin
 Real-time algorithm as it responds to an
event within a specific time limit.
 focuses on the Time Sharing technique.
► It is a Preemptive type of CPU scheduling algorithm in OS.
 One of the oldest, fairest, and easiest
algorithm. ► Every process gets a fixed amount of time quantum to
execute the process.
 Every process gets an equal share of the
CPU. ► Processes that have their burst time remaining after the
 Distributes work evenly among all expiration are sent back to the ready state and wait for their
available resources. next turn to complete the execution until it terminates.
 Helps in resource utilization and overall ► The CPU time quantum is the time period defined in the
performance of the system. system.
Priority Scheduling with
Round Robin Why Use Priority Scheduling
with Round Robin?
 Ensures fairness
 Each process to execute for a fixed
 In priority scheduling with Round-Robin, processes are
time slice regardless of its priority
scheduled based on their priority levels.
 Useful in real-time systems where
 A higher-priority process is given the CPU over lower-
tasks have strict deadlines
priority processes.
 Dynamic environments where the  If multiple processes have the same priority, Round-Robin
priority of processes may change over
scheduling is used to ensure fairness and prevent starvation.
time
 The CPU is allocated to the process with the highest priority
 Responsiveness (smallest integer  highest priority)
Round Robin Example
Mode Preemptive

Process Arrival Time Brust Time

P1 0 5
P2 1 4
P3 2 2
P4 4 1

Quantum Time = 2
Continue

Process Arrival Time Brust Time

P1 0 5
P2 1 4
Quantum Time = 2
P3 2 2
P4 4 1

P1 P2 P3 P1 P4 P2 P1
Ready Queue

P1 P2 P3 P1 P4 P2 P1
Running Queue

0 2 4 6 8 9 11 12
Calculation
P1 P2 P3 P1 P4 P2 P1
Running Queue

0 2 4 6 8 9 11 12

 Turnaround Time (TAT) = Completion Time – Arrival Time


 Waiting Time (WT) = Turnaround Time – Brust Time

Process Arrival Time Brust Time Completion Time Turnaround Time Waiting Time

P1 0 5 12 12 7

P2 1 4 11 10 6

P3 2 2 6 4 2

P4 4 1 9 5 4

 Average Turnaround Time = (12 + 10 + 4 + 5) / 4 = 7.75

 Average Waiting Time = (7 + 6 + 2 + 4) / 4 = 4.75


Priority Scheduling with Round-Robin

Process Burst Time (ms) Priority [Lower Number = Higher Priority]

P1 4 3
P2 5 2
P3 8 2
P4 7 1
P5 3 3

Quantum Time = 2
Continue
Process Burst Time (ms) Priority

P1 4 3
P2 5 2
Quantum Time = 2
P3 8 2
P4 7 1
P5 3 3

Running Queue P4 P2 P3 P2 P3 P2 P3 P1 P5 P1 P5
/ Gantt Chart
0 7 9 11 13 15 16 20 22 24 26 27
Calculation
P4 P2 P3 P2 P3 P2 P3 P1 P5 P1 P5
Running Queue

0 7 9 11 13 15 16 20 22 24 26 27

 Turnaround Time (TAT) = Completion Time – Arrival Time


 Waiting Time (WT) = Turnaround Time – Brust Time

Process Burst Time Priority Completion Time Turnaround Time Waiting Time

P1 4 3 26 26 22

P2 5 2 16 16 11

P3 8 2 20 20 12

P4 7 1 7 7 0

P5 3 3 27 27 24

 Average Turnaround Time = (26+16+20+7+27) / 5 = 96/5 = 19.2

 Average Waiting Time = (22+11+12+0+24) / 5 = 69/5 = 13.8


ADVANTAGES OF ROUND ROBIN

► Equal share of CPU.


► Deals with processes without any priority
► Giving each Process a time slot
► Context switching method
► Best average response time.
LIMITATIONS OF ROUND ROBIN

► Larger waiting time


► performance heavily depends on time quantum
► spends more time on context-switching
► Priorities cannot be set
► Time-consuming scheduling for small quantum
The Round Robin CPU scheduling algorithm ensures equal CPU access
by assigning a fixed time quantum to each activity fairly and preemptively.
CONCLUSION While it promotes fairness and prevents starvation, it may result in longer
waiting times and reduced throughput, depending on the time quantum.
Effective program implementation allows for the calculation of key
metrics like completion time, turnaround time, and waiting time, aiding in
performance evaluation and optimization.
THANK YOU

You might also like