Facebook Pixel

Preemptive vs Non-Preemptive Scheduling

In a multiprogramming system, the CPU must decide which process should run next. This decision-making is handled through process scheduling, which helps maximize CPU usage and ensures efficient execution. A scheduling policy defines how one process is chosen from the ready queue for execution.

Types of Scheduling

Process scheduling techniques are generally divided into two main categories:

  • Preemptive Scheduling
  • Non-Preemptive Scheduling

Non-Preemptive Scheduling

In non-preemptive scheduling, once a process gets control of the CPU, it continues running until it finishes execution or moves into a waiting state (such as for I/O). The CPU is not taken away from the process in between.

The scheduler assigns the next process only after the current one completely releases the CPU.

Common Examples:

  • First-Come-First-Serve (FCFS)
  • Shortest Job First (SJF)
  • Priority Scheduling (Non-preemptive)
  • Highest Response Ratio Next (HRRN)

Advantages:

  • Easy to design and implement
  • Lower system overhead
  • Fewer context switches
  • Predictable and consistent behavior

Disadvantages:

  • Poor response to dynamic system changes
  • May lead to deadlocks in some cases
  • A faulty or long-running process can block others completely

Preemptive Scheduling

In preemptive scheduling, the CPU can be taken away from a running process before it finishes. The operating system may interrupt the current process and assign the CPU to another one.

Situations Where Preemption Occurs:

  • When a process exceeds its allotted time slice
  • When a higher-priority process arrives
  • When a shorter job enters the system (e.g., in Shortest Remaining Time scheduling)

Common Examples:

  • Round Robin (RR)
  • Shortest Remaining Time First (SRTF)
  • Priority Scheduling (Preemptive)

Advantages:

  • Prevents any single process from dominating the CPU
  • Improves response time
  • More flexible and adaptive scheduling
  • Helps reduce chances of deadlock

Disadvantages:

  • Frequent context switching increases overhead
  • Requires more memory to store process states
  • Low-priority or long processes may suffer starvation
  • More complex to implement and manage

Key Differences

Preemptive SchedulingNon-Preemptive Scheduling
CPU can interrupt a process anytimeProcess runs until completion
Better responsivenessSlower response time
Higher overhead due to switchingLower overhead
Fair CPU sharingCPU may be monopolized
More complexSimpler to implement
Starvation possible (low priority)Starvation possible (long jobs)
Helps avoid deadlocksHigher risk of deadlocks
Summary
Preemptive scheduling offers flexibility and better responsiveness but comes with additional overhead and complexity. Non-preemptive scheduling is simpler and more predictable, but it may lead to inefficient CPU usage in dynamic environments. The choice between them depends on system requirements and performance goals.

Knowledge Check

Question 1 of 2

Test your understanding of Preemptive and Non-Preemptive scheduling.

Which of the following is a major disadvantage of Non-Preemptive Scheduling?
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.