Round Robin Algorithm
Round Robin Algorithm
CPU Scheduling
Algorithm
Presented By:
Muhammad Nazir(2021-CS-8)
Muhammad Umar(2021-CS-24)
Outlines
Introduction
Preemptive Algorithm
Non Preemptive Algorithm
CT, TAT, RT, WT (Times)
Code Snippets
Example
Conclusion
Round Robin is a CPU scheduling Preemptive
algorithm in operating systems, in which each process
is assigned a fixed time unit, called time quantum.
Introduction
In this algorithm, we take each process to ready queue and goes to running queue.
Ready 2s Running
Queue Queue
Important Formulas:
• TAT =CT-AT
• WT = TAT-BT
• RT= CPU First Time in Running Queue - AT
Example1 (For Different Arrival Time)
P1 0 5
P2 1 4
P3 2 2
P4 4 1
Example1
Quantum = 2
Ready Queue:
P1 P2 P3 P1 P4 P2 P1
T=0
Running Queue:
P1 P2 P3 P1 P4 P2 P1
T=0 2 4 6 8 9 11 12
Example1 (For Different Arrival Time)
P1 0 7
P2 0 5
P3 0 5
Example1
Quantum = 2
Ready Queue:
P1 P2 P3 P1 P2 P3 P1 P2 P3 P1
T=0
Running Queue:
P1
T=0 2 P2 4 P3 6 P1 8 P2 10 P3 12 P1 14 P2 15 P3 17 P1 18
Example2 (For Same Arrival Time)
Process No Arrival Time Burst Time Completion Turn Around Waiting Time
(AT) (BT) Time (CT) Time (TAT) (WT)
P1 0 7 18 18-0=18 11
P2 0 5 15 15-0=15 10
P3 0 5 17 17-0=17 12
Example2
Conclusion