Preemptive Scheduling is a CPU scheduling technique that works by dividing time slots of CPU to a given process. The time slot given might be able to complete the whole process or might not be able to it. When the burst time of the process is greater than CPU cycle, it is placed back into the ready queue and will execute in the next chance. This scheduling is used when the process switch to ready state.
Algorithms that are backed by preemptive Scheduling are round-robin (RR), priority, SRTF (shortest remaining time first).
Non-preemptive Scheduling is a CPU scheduling technique the process takes the resource (CPU time) and holds it till the process gets terminated or is pushed to the waiting state. No process is interrupted until it is completed, and after that processor switches to another process.
Algorithms that are based on non-preemptive Scheduling are non-preemptive priority, and shortest Job first.
Preemptive Vs Non-Preemptive Scheduling
|Preemptive Scheduling||Non-Preemptive Scheduling|
|Resources are allocated according to the cycles for a limited time.||Resources are used and then held by the process until it gets terminated.|
|The process can be interrupted, even before the completion.||The process is not interrupted until its life cycle is complete.|
|Starvation may be caused, due to the insertion of priority process in the queue.||Starvation can occur when a process with large burst time occupies the system.|
|Maintaining queue and remaining time needs storage overhead.||No such overheads are required.|