- Back to Home »
- Preemptive and Non-Preemptive Scheduling
Preemptive and Non-Preemptive Scheduling:
There are four conditions under which CPU scheduling may take place. They are:
1. When a process switches from the running state to the waiting state.
2. When a process switches from the running state to the ready state.
3. When a process switches from the waiting state to the ready state.
4. When a process terminates
If only conditions 1 and 4 apply, the scheduling is called non-preemptive. All other scheduling is preemptive. Preemption basically means that a process may be forcibly removed from the CPU even if it does not want to release the CPU i.e. it is still executing but a higher priority process needs the CPU.
Once a process gets CPU, the simplest approach is to allow the .process to continue using the CPU until it voluntarily yields the CPU e.g. by requesting an IO transfer. I/O interrupts may steal the CPU from time to time. After each interrupt, control passes back to the process that was running when it occurred. This is called a non-preemptive approach.
In a preemptive scheme, .a running process may be forced to yield the CPU (thus returning to the ready list) by an external event rather than by its own action. Such external events can be either or both of the following kinds:
- A higher priority process enters the system from outside.
- A higher-priority process that was in the wait state becomes ready. This could occur as the result of an I/O interrupt that moves a waiting process to the ready list.