CPU Scheduling Algorithms
To decide which process has to execute first and which process has to execute later, is done through CPU scheduling algorithms. OS also use CPU Scheduler to schedules 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 complete its execution.
2. Preemptive scheduling
It allows a running process to be interrupted by a high priority process.
Note: But he condition In both cases (preemptive and non-preemptive) is, if any interrupt is occur during the process execution. Then CPU leave the current running process and shift 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 both types, preemptive and non-preemptive, with examples in next lectures.