Learning Objectives
• Understandthe need for CPU scheduling.
• Learn various CPU scheduling algorithms.
• Compare scheduling strategies.
• Analyze advantages and drawbacks of each.
3.
What is CPUScheduling?
• The OS decides which of the ready processes
should be assigned to the CPU.
• Improves CPU utilization and responsiveness.
• Essential in multiprogramming environments.
4.
Scheduling Criteria
• CPUUtilization
• Throughput
• Turnaround Time
• Waiting Time
• Response Time
• Fairness
5.
Scheduling Types
• Preemptive:CPU can be taken from a process.
• Non-preemptive: Process keeps CPU until it
terminates or waits.
Shortest Job First(SJF)
• Can be preemptive or non-preemptive.
• Shortest burst time first.
• Pros: Optimal in average waiting time.
• Cons: Requires knowledge of burst time.
8.
Round Robin (RR)
•Preemptive scheduling.
• Each process gets CPU for a fixed time
quantum.
• Used in time-sharing systems.
9.
Priority Scheduling
• Eachprocess assigned a priority.
• CPU given to the highest priority process.
• Issue: Starvation of low-priority processes.
• Solution: Aging.
10.
Comparison Table
Algorithm PreemptiveAvg Waiting Time Use Case
FCFS No High Simple systems
SJF Yes/No Low Batch jobs
RR Yes Moderate Interactive
Priority Yes/No Varies Mixed priority
systems