0% found this document useful (0 votes)
3 views

Comparison of Scheduling Algorithms[1]

The document provides an overview of various CPU scheduling algorithms, including First-Come, First-Served, Shortest Job Next, Priority Scheduling, and Round Robin, detailing their characteristics, advantages, and disadvantages. It emphasizes key scheduling criteria such as CPU utilization, throughput, and response time, and includes examples and comparisons of the algorithms. The conclusion highlights that no single algorithm is optimal for all scenarios, advocating for a hybrid approach in modern operating systems to balance efficiency and fairness.

Uploaded by

tanmay.aj2004
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Comparison of Scheduling Algorithms[1]

The document provides an overview of various CPU scheduling algorithms, including First-Come, First-Served, Shortest Job Next, Priority Scheduling, and Round Robin, detailing their characteristics, advantages, and disadvantages. It emphasizes key scheduling criteria such as CPU utilization, throughput, and response time, and includes examples and comparisons of the algorithms. The conclusion highlights that no single algorithm is optimal for all scenarios, advocating for a hybrid approach in modern operating systems to balance efficiency and fairness.

Uploaded by

tanmay.aj2004
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Comparison of Scheduling Algorithms

Understanding and Analyzing CPU Scheduling Techniques


Group Members

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

• Definition: CPU scheduling determines the


order in which processes access the CPU.
• Objective: Maximize CPU utilization,
throughput, and fairness while minimizing
response time and waiting time.
• Types of Scheduling:
• - Preemptive
• - Non-preemptive
Key Scheduling Criteria

• - CPU Utilization: Keep the CPU as busy as possible.


• - Throughput: Number of processes completed per
time unit.
• - Turnaround Time: Time taken from submission to
completion of a process.
• - Waiting Time: Total time a process waits in the ready
queue.
• - Response Time: Time taken to start responding to a
request.
Types of Scheduling Algorithms
• First-Come, First-Served (FCFS)
1

• Shortest Job Next (SJN) or Shortest Job First (SJF)


2

• Priority Scheduling
3

• Round Robin (RR)


4

• Multilevel Queue Scheduling


5

• Multilevel Feedback Queue Scheduling


6
First-Come, First-Served (FCFS)

• 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)

• Type: Non-preemptive or preemptive (Shortest


Remaining Time First)
• Working: Schedules the process with the
shortest burst time first.
• Pros: Optimal for minimizing waiting time
• Cons: Can cause starvation for longer processes
• Example: Sorting processes by burst time
Preemptive Shortest Job First Scheduling Example
Consider the following table of arrival time and burst time for process P1, P2 and P3
Process Arrival Time Burst Time
P1 0 10
Average Turn around time = = = 20 ms
P2 1 5
Average waiting time = = = 10.5 ms
P3 2 8
P4 3 15

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

• Type: Preemptive or Non-preemptive


• Working: Processes are scheduled based on
priority.
• Pros: Flexible, can handle critical processes
• Cons: Starvation of low-priority processes
(solved by aging)
• Example: Real-time systems
Priority Scheduling Example
Consider the following table of arrival time and burst time for process P1, P2 and P3,P4,P5
Process Burst Time Priority
P1 12 4
P2 10 5 Average Turn around time = = = 16.6 ms
P3 5 2 Average waiting time = = = 9.8 ms
P4 4 1
P5 3 3
Process Burst Time Burst Time Computational Time Turn Around Time Waiting Time

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

• Algorithm | Preemptive | Fairness | Starvation | Response Time | Overhead


• FCFS | No | Low | No | High | Low
• SJN/SJF | Yes/No | Medium | Yes | Medium | Medium
• Round Robin | Yes | High | No | Low | High
• Priority Scheduling | Yes/No | Low/Medium | Yes (w/o aging) | Medium | Medium
• Multilevel Queue | Yes/No | Medium | Yes | Variable | High
• Multilevel Feedback | Yes | High | Low | Variable | Very High
Conclusion

• - No single algorithm is universally best — the


choice depends on the system's needs.
• - A hybrid approach often works best in
modern operating systems.
• - Balancing efficiency, fairness, and
responsiveness is key to good scheduling.
Thank You

You might also like