Preemptive Scheduling vs Non Preemptive Scheduling

The process manager in an operating system is responsible for process scheduling. It is an operating system activity in which a running process is removed from the CPU and is replaced by another high priority process following certain set of rules. Process scheduling is an important part of a multi programming system where multiple processes need execution. The process of scheduling can be categorised into two, Pre-emptive and non-pre-emptive scheduling.

Pre-emptive Scheduling

Scheduling in which a process is switched from the running state to the ready state and from the waiting state to the ready state. In this concept, the CPU is allocated to the process for a limited time and is again taken back when its time is over. The current state of the program is saved and is resumed again when the process is assigned to the CPU.    

Non Pre-emptive Scheduling

In this case, once the process is allocated the CPU, it is only released when the processing is over. The states into which a process switches are the running state to the waiting state. It is an approach in which a process is not interrupted when it is under process by the CPU.

Learn more about Non preemptive scheduling through Shortest Job First Scheduling (SJF) algorithm here.

Preemptive Scheduling vs Non Preemptive Scheduling

Key Differences

Pre-emptive SchedulingNon- pre-emptive Scheduling
CPU allocation is for a limited time.CPU allocation until the process is complete.
Execution of the process is interrupted in the middle.Execution of the process remains uninterrupted until it is completed.
The concept bears an overhead of switching between the tasks.No such overhead of switching between the tasks.
If the CPU receives continuous high priority tasks, a process may remain in the waiting state indefinitely. If the CPU is processing a program with the largest burst time, even a program with the smallest burst time may have to starve.
It allows flexibility to the processes which are in the waiting state allowing the high priority tasks to be executed first. This approach is also known as the rigid scheduling as it offers no flexibility to the processes irrespective of their urgency for execution.
Pre emptive scheduling needs to maintain the integrity of the shared data and to ensure no data loss occurs when processes are swapped from the waiting state to the ready state.The Non- pre-emptive Scheduling does not require to maintain data integrity as no processes are swapped from the waiting state to the ready state.