CPU Scheduling Algorithms
Deciding which process has to be executed first and which process has to be executed later is done through CPU scheduling algorithms. OS also uses CPU Scheduler to schedule different processes.
Types of CPU Scheduling
1. Non-preemptive scheduling
Every new process has to wait until the running process finishes its CPU cycle or completes its execution.
2. Preemptive scheduling
It allows a running process to be interrupted by a high-priority process.
Note: But the condition In both cases (preemptive and non-preemptive) is if any interrupt occurs during the process execution. Then, the CPU leaves the current running process and shifts to that interrupt.
Some scheduling algorithms in Non-preemptive are
- First Come First Serve (FCFS)
- Shortest Job First (SJF)
- Highest Priority (0 is the highest priority)
- Highest response ratio Next (HRRN)
Some scheduling algorithms in preemptive are
- Shortest remaining time first
- Round Robin
- Priority Based
- Multilevel Queue
- Multi-level feedback
The Purpose of CPU Scheduling Algorithm
- Maximum utilization of CPU
- Maximum throughput
- Minimum waiting time
- Highly responsive
We will explain preemptive and non-preemptive types, with examples in the next lectures.