Comparison of Scheduling Algorithms[1]
Comparison of Scheduling Algorithms[1]
Name Roll No
Darshan Gowda 413
Kasturi Hagawane 414
Siddhant Jadhav 415
Tanmay Jadhav 416
Yash Jadhav 417
Yashodeep Jadhav 418
Introduction to CPU Scheduling
• Priority Scheduling
3
• Type: Non-preemptive
• Working: Processes are scheduled in the order
they arrive.
• Pros: Simple, easy to implement
• Cons: Convoy effect, high waiting time for long
processes
• Example: Process scheduling in a single queue
First-Come, First-Serve (FCFS) Scheduling Example
Consider the following table of arrival time and burst time for process P1, P2 and P3
Process Arrival Time Burst Time
Average Turn around time = = = 10.33 ms
P1 0 5 Average waiting time = = = 6.33 ms
P2 0 3
P3 0 8
Process Arrival Time Burst Time Computational Time Turn Around Time Waiting Time
P1 0 5 5 5-0=5 5-5=0
P2 0 3 8 8-0=8 8-3=5
P3 0 8 16 16-0=16 16-8=8
P1 P2 P3
0 5 8 16
Gantt Chart for First-Come, First-Serve (FCFS) Example
Shortest Job Next (SJN/SJF)
Process Arrival Time Burst Time Computational Time Turn Around Time Waiting Time
P1 0 10 10 10-0=10 0
P2 1 5 15 15-1=14 10-1=9
P3 2 8 23 23-2=21 15-2=13
P4 3 15 38 38-3=35 23-3=20
P1 P2 P3 P4
0 10 15 23 38
Gantt Chart for Preemptive Shortest Job First Example
Priority Scheduling
P1 12 4 4 24-0=24 12
P2 10 5 9 34-0=34 24
P3 5 2 12 9-0=9 4
P4 4 1 24 4-0=4 0
P5 3 3 34 12-0=12 9
P1 P2 P3 P4 P5
0 4 9 12 24 34
Gantt Chart for Priority Scheduling Example
Round Robin (RR)
• Type: Preemptive
• Working: Each process gets a fixed time slice
(quantum) in cyclic order.
• Pros: Fair, responsive
• Cons: High context-switching overhead
• Example: Time-shared systems
Round Robin Scheduling Example
Consider the following table of arrival time and burst time for process P1, P2 and P3
Process Burst Time
P1 11 Average Turn around time = = = 26.5 ms
P2 7 Average waiting time = = = 14.25 ms
P3 15
P4 4
Process Burst Time Computational Time Turn Around Time Waiting Time
P1 11 30 30-0=30 0+(16-4)+(27-20)=19
P2 7 23 23-0=23 4+(20-8)=16
P3 15 37 37-0=37 8+(23-12)+(30-27)=22
P4 4 8 16-0=16 12
P1 P2 P3 P4
0 10 15 23 38
Gantt Chart for Round Robin Scheduling Example
Some More Examples
Multilevel Queue Scheduling
Multilevel Feedback Queue Scheduling
• Type: Can be preemptive or non- • Type: Preemptive
preemptive
• Working: Processes can
• Working: Processes are grouped
into queues, each with different move between queues
priorities or scheduling algorithms. based on their behavior and
• Pros: Suitable for systems with execution history.
different process types • Pros: Dynamic, adaptable
• Cons: Complex, less flexible within
a queue • Cons: Complex to
• Example: OS handling system, implement
interactive, and batch processes • Example: Modern operating
separately systems
Comparison Table
FCFS SJF Round Piority Multilevel Multilevel
Robin Queue Feedback
Algorithm No
Preemptiv Low
e
Fairness No
Starvation High
Response Low
Time
Overhead