What is Non-Preemptive Scheduling?
In this, once a process enters the running state it cannot be preempted until it completes it’s allocation time. When scheduling takes place only under the below circumstances we say that the scheduling scheme is non-preemptive or cooperative.
- When a process enters the waiting state (due to an I/O request or an attempt to call wait() to end a child process), it changes from the running state.
- when a process comes to an end.
A process cannot be stopped under non-preemptive scheduling until it ends on its own or runs out of time. A process with a longer burst time on its CPU would cause a process with a shorter burst time to starve.
Example of Non-Preemptive Scheduling: Consider there are four processes P0, P1, P2, and P3 uses non-preemptive scheduling technique.
Process ID |
Arival Time |
Burst Time |
---|---|---|
P0 |
3 |
2 |
P1 |
2 |
4 |
P2 |
0 |
6 |
P3 |
1 |
4 |
Advantages of Non-Preemptive Scheduling
- It has a minimal scheduling overhead.
- It’s an extremely easy technique.
- Less processing power is used.
- It provides a high throughput.
Disadvantages of Non-Preemptive Scheduling
- For the procedure, it responds slowly.
- Errors can cause a machine to freeze.
Difference Between Preemptive and Non-Preemptive CPU Scheduling Algorithms
Preemptive scheduling permits a high-priority task to interrupt a running process, When a process transitions from the running to the ready or from the waiting to the ready states, preemptive scheduling is used. Whereas in non-preemptive scheduling, any new process must wait until the running process completes its CPU cycle. In this article, we will discuss what are preemptive and non-preemptive scheduling and their differences.