Non Preemptive Scheduling in Operating System (OS)

Non preemptive scheduling algorithm

On this page, we will learn the concepts of non preemptive scheduling in operating system (OS) with detailed explanation. Non preemptive scheduling is a type of scheduling process where the resources allocated to a process are released only after the process gets fully executed.

The primary advantage of non-preemptive scheduling is that it reduces the complexity of process switching, as there is no need to handle interruptions. However, it can lead to inefficiency, particularly when a long process blocks other shorter processes from executing.

Non preemptive scheduling in OS

Overview

An operating system often assigns the CPU to processes that need execution. The method used to carry out such a function is known as Scheduling. The method can be of two types, pre-emptive, and non-preemptive scheduling. In the first case, every process is allocated a fixed amount of time to the CPU. When this time is over, the process is replaced by another process which is waiting for the state. On the other hand, the second type of scheduling is the non-preemptive scheduling in which, the process releases the CPU only after its execution is completed.

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.

This scheduling approach ensures that once a process begins executing, it is not preempted by other processes, even if a higher-priority process becomes available. The transition of states in non-preemptive scheduling typically occurs from the running state to the waiting state or terminated state.

Non-Preemptive Type Scheduling

Some of the important points about this approach are:

  • Once the CPU starts executing a process, it finishes before picking up another process.
  • Less CPU utilization as compared to pre-emptive scheduling.
  • In this case, the response time and the waiting time is more.
  • Once a process enters the running state, its state is not deleted from the scheduler until the process is finished executing or finishes its service time.
  • If a process with a long burst time is being executed, then a process with minimum burst time might have to starve.
  • The scheduling approach is also known as rigid.
  • Some of its examples are FCFS, SJF, Priority, etc.

The following diagrammatic representation explains the concept.

diagrammatic representation
Non Preemptive Scheduling

Advantages and Disadvantages of Non-Preemptive Scheduling

Advantages of Non-Preemptive Scheduling:

  • Less Context Switching: Since processes are not preempted, the system does not need to save and restore the state of processes frequently.
  • Predictable Execution: Processes run uninterrupted until they finish, making the execution time more predictable.
  • Reduced Overhead: With fewer interruptions, there’s less overhead in managing processes, making this approach efficient in certain systems.

Disadvantages of Non-Preemptive Scheduling:

  • Poor Responsiveness: If a long running process is executing, shorter or more urgent tasks may have to wait for it to complete, leading to poor system responsiveness.
  • Starvation of Lower Priority Processes: In systems with varying process priorities, low priority processes may get indefinitely delayed if higher-priority processes keep arriving.
  • Inefficiency in Multi Tasking Environments: For systems where many processes need to run concurrently, non-preemptive scheduling may not be ideal, as it prevents more dynamic task switching.

Applications of Non-Preemptive Scheduling:

  • Batch Systems: Non-preemptive scheduling is commonly used in batch systems where tasks are processed in a predetermined order without the need for interaction with the user.
  • Real-Time Systems: In some real-time systems, where tasks have strict timing constraints, non-preemptive scheduling is used to ensure that processes are not interrupted during critical operations.
  • Embedded Systems: In embedded systems, where resources are limited, non-preemptive scheduling may be employed to reduce complexity and conserve resources.

To wrap up

Non-Preemptive Scheduling in operating systems ensures that once a process starts executing, it is not interrupted until completion, offering advantages like reduced context switching and predictable execution. However, it can lead to inefficiencies, such as poor responsiveness and the potential for process starvation, especially in multitasking environments. While it works well in batch, real time, and embedded systems, its limitations make it less suitable for systems requiring dynamic task switching. Overall, the choice of scheduling method depends on the system’s specific needs and priorities.

FAQs

Non-preemptive scheduling reduces context switching, ensuring predictable execution of processes without interruptions, making it ideal for systems with stable tasks.

The primary drawbacks include poor system responsiveness and potential starvation of lower priority processes, as long tasks can delay others.

Non-preemptive scheduling works well in batch, real-time, and embedded systems but may not be effective in environments requiring frequent task switching or multitasking.

Non-preemptive scheduling generally results in lower CPU utilization compared to preemptive scheduling, as processes that could be interrupted are allowed to run to completion without interruption.