Difference between Preemptive and Non Preemptive Scheduling

The 3rd generation of computers introduced the concept of multiprogramming. In 1968, this concept came into existence. Before, there was no such multitasking performance given by computers. Computer systems would perform a single task at a time. This would be a time-consuming and hectic process. In uni-programming systems, if the processor is busy performing one task and if it has to wait for any I/O operation then the CPU remained idle. This caused the problem of starvation. Now, there is an improved version of programming systems called multiprogramming. Here, CPU does not remain idle even in its waiting time. It shifts its queue and starts executing another process.

The Operating System schedules the process according to the order of execution and performs maximum utilization of the CPU. This process is called scheduling.

The main objective of CPU scheduling is to make sure that when the CPU remains idle, it should have at least one process available in the ready queue for execution.

We have understood the task of CPU scheduling. Now let us see its types. Generally, there are two types of scheduling methods.

  • Preemptive Scheduling
  • Non-Preemptive Scheduling

Firstly, let’s see what is the difference between Preemptive and Non Preemptive Scheduling.

Difference between Preemptive and Non Preemptive Scheduling in tabular form

Preemptive Scheduling Non-Preemptive Scheduling
In preemptive scheduling, the CPU (processor) is allocated to the process for a certain amount of time. In non-preemptive scheduling, the CPU (processor) is allocated to the process till it completes its execution or requests any I/O device and switches to a waiting state.
Process execution is disturbed in between the execution Process execution is not disturbed in between the execution
This type of scheduling has  more CPU utilization as compared to non-preemptive scheduling This type of scheduling has less CPU utilization as compared to preemptive scheduling
It has less waiting time and less response time It has more waiting time and more response time
Starvation may occur in low priority process if high priority process occurs more frequently Starvation may occur in low priority process if high priority is running the processor for a long time
Overheads are required for maintaining queue and remaining time No such overheads are required
Preemptive scheduling is more complex Non-preemptive scheduling is easy and more efficient
Preemptive scheduling is costlier than non-preemptive scheduling as it has to store the shared data Non-Preemptive scheduling is less costly than preemptive scheduling because it does not have to store the shared data
Examples of preemptive scheduling are Round Robin and Shortest Remaining Time First Examples of non-preemptive scheduling are First Come First Serve and Shortest Job First

What is Preemptive Scheduling?

Preemptive scheduling is the method of CPU scheduling where the processor works according to the priorities of the process. In simple words, when a process is ready in a ready queue and is selected by the processor for execution. If in case another process is waiting in a ready queue, so this type of scheduling immediately allows another process of high priority to perform its execution. It preempts the process after some time and shifts to another process.

If the process of comparatively high priority arrives in the ready queue then the currently running process is paused and placed in the ready queue and the process with high priority utilizes the processor for its execution. In this way, each process present in a ready queue gets a chance for utilizing the CPU. No process remains unattended.

This scheduling is flexible and costs associated as it needs to save the integrated data that is interrupted in between and to utilize it again when the process is resumed. It is robust and best suited in a multi-programming environment.

What is Non-Preemptive Scheduling?

Non-Preemptive Scheduling is a type of scheduling where the process in running state terminates only after its completion or if it reaches the waiting state. It does not preempt in between if a higher priority process is ready in the ready queue. Instead, it waits for the process to complete and then allows another process to utilize the CPU cycle. In this type of schedule, if the currently executing process has a long CPU burst time, then other processes have to wait for a long time. There is a possibility that all the processes may not get a chance for CPU utilization. However, there is very little possibility of overhead as the process is completed once. So no need to save the paused data. There is no cost associated with this scheduling and requires less computational resources.

Hope the difference between preemptive and non-preemptive scheduling is pretty clear. The concept is very interesting and easy to understand. We cannot say that preemptive scheduling is better than non-preemptive scheduling or vice versa. It depends on how the scheduling maximizes its CPU utilization and reduces its idle time.

Author
Shraddha Changune
SVKM’s Institute of Technology, Dhule

References

1. https://techdifferences.com/difference-between-preemptive-and-non-preemptive-scheduling-in-os.html
2. https://www.guru99.com/cpu-scheduling-algorithms.html
3. https://www.studytonight.com/operating-system/cpu-scheduling

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.