What is the difference between Preemptive and Non-Preemptive scheduling?

In the Operating System, the process scheduling algorithms can be divided into two broad categories i.e. Preemptive Scheduling and Non-Preemptive Scheduling. In this blog, we will learn the difference between these two. So, let's get started.

Preemptive Scheduling

In preemptive scheduling, the CPU will execute a process but for a limited period of time and after that, the process has to wait for its next turn i.e. in preemptive scheduling, the state of a process gets changed i.e. the process may go to the ready state from running state or from the waiting state to the ready state. The resources are allocated to the process for a limited amount of time and after that, they are taken back and the process goes to the ready queue if it still has some CPU burst time remaining. Some of the preemptive scheduling algorithms are Round-robin, SJF (preemptive), etc.

Non-preemptive Scheduling

In non-preemptive scheduling, if some resource is allocated to a process then that resource will not be taken back until the completion of the process. Other processes that are present in the ready queue have to wait for its turn and it cann't forcefully get the CPU. Once the CPU is allocated to a process, then it will be held by that process until it completes its execution or it goes in the waiting state for I/O operation.

Difference between Preemptive and Non-preemptive scheduling

  • In preemptive scheduling, the CPU can be taken back from the process at any time during the execution of the process. But in non-preemptive scheduling, if the CPU is allocated, then it will not be taken back until the process completes its execution.
  • In preemptive scheduling, a process can be interrupted by some high priority process but in non-preemptive scheduling no interruption by other processes is allowed.
  • The preemptive approach is flexible in nature while the non-preemptive approach is rigid in nature.
  • In preemptive scheduling, the CPU utilization is more as compared to the non-preemptive approach.
  • In preemptive scheduling, the waiting and response time is more. While in non-preemptive scheduling, the waiting and response time is less(learn more about waiting and response time from here ).
  • In a preemptive approach, if higher priority process keeps on coming, then it can lead to starvation(read more about starvation from here ). But in a non-preemptive approach, if process having higher burst time keeps on coming, then it can lead to starvation(read more about burst time from here ).

That's it for this blog. Hope you learned something new today. You can learn about " Various process scheduling algorithms in OS " from here .

Do share this blog with your friends to spread the knowledge. Visit our YouTube channel for more content. You can read more blogs from here .

Keep Learning :)

Team AfterAcademy!