Preemptive Scheduling

Preemptive scheduling is used when a process switches from the running state to the ready state or from the waiting state to the ready state. The resources (mainly CPU cycles) are allocated to the process for a limited amount of time and then taken away, and the process is again placed back in the ready queue if that process still has CPU burst time remaining. That process stays in the ready queue till it gets its next chance to execute. 

Algorithms based on preemptive scheduling are Round Robin (RR), Shortest Remaining Time First (SRTF), Priority (preemptive version), etc. 

 

Preemptive scheduling has a number of advantages and disadvantages. The following are preemptive scheduling’s benefits and drawbacks:

Advantages

  1. Because a process may not monopolize the processor, it is a more reliable method.
  2. Each occurrence prevents the completion of ongoing tasks.
  3. The average response time is improved.
  4. Utilizing this method in a multi-programming environment is more advantageous.
  5. The operating system makes sure that every process using the CPU is using the same amount of CPU time.

Disadvantages

  1. Limited computational resources must be used.
  2. Suspending the running process, change the context, and dispatch the new incoming process all take more time.
  3. The low-priority process would have to wait if multiple high-priority processes arrived at the same time.

Preemptive and Non-Preemptive Scheduling

Prerequisite – CPU Scheduling 

You will discover the distinction between preemptive and non-preemptive scheduling in this article. But first, you need to understand preemptive and non-preemptive scheduling before going over the differences.

Similar Reads

Preemptive Scheduling

Preemptive scheduling is used when a process switches from the running state to the ready state or from the waiting state to the ready state. The resources (mainly CPU cycles) are allocated to the process for a limited amount of time and then taken away, and the process is again placed back in the ready queue if that process still has CPU burst time remaining. That process stays in the ready queue till it gets its next chance to execute....

Non-Preemptive Scheduling

Non-preemptive Scheduling is used when a process terminates, or a process switches from running to the waiting state. In this scheduling, once the resources (CPU cycles) are allocated to a process, the process holds the CPU till it gets terminated or reaches a waiting state. In the case of non-preemptive scheduling does not interrupt a process running CPU in the middle of the execution. Instead, it waits till the process completes its CPU burst time, and then it can allocate the CPU to another process....

Key Differences Between Preemptive and Non-Preemptive Scheduling

In preemptive scheduling, the CPU is allocated to the processes for a limited time whereas, in Non-preemptive scheduling, the CPU is allocated to the process till it terminates or switches to the waiting state. The executing process in preemptive scheduling is interrupted in the middle of execution when a higher priority one comes whereas, the executing process in non-preemptive scheduling is not interrupted in the middle of execution and waits till its execution. In Preemptive Scheduling, there is the overhead of switching the process from the ready state to the running state, vise-verse, and maintaining the ready queue. Whereas in the case of non-preemptive scheduling has no overhead of switching the process from running state to ready state. In preemptive scheduling, if a high-priorThe process The process non-preemptive low-priority process frequently arrives in the ready queue then the process with low priority has to wait for a long, and it may have to starve. , in non-preemptive scheduling, if CPU is allocated to the process having a larger burst time then the processes with a small burst time may have to starve. Preemptive scheduling attains flexibility by allowing the critical processes to access the CPU as they arrive in the ready queue, no matter what process is executing currently. Non-preemptive scheduling is called rigid as even if a critical process enters the ready queue the process running CPU is not disturbed. Preemptive Scheduling has to maintain the integrity of shared data that’s why it is cost associative which is not the case with Non-preemptive Scheduling....

Frequently Asked Questions

Q.1: How is priority determined in preemptive scheduling?...