In CPU scheduling, what is the difference between preemptive and non preemptive scheduling policies?

Difficulty: Easy

Correct Answer: In preemptive scheduling the operating system may forcibly take the CPU away from a running process, while in non preemptive scheduling a running process keeps the CPU until it voluntarily releases it by terminating or blocking

Explanation:


Introduction / Context:
CPU scheduling algorithms decide which process runs on the CPU at any given time. A key design choice is whether the scheduler can interrupt a running process and switch to another one. This leads to two broad categories: preemptive and non preemptive scheduling. Many exam questions ask you to state the difference between these two approaches and to recognize examples of each.


Given Data / Assumptions:

  • The operating system can generate timer interrupts at regular intervals.
  • There is a ready queue containing processes that are able to run.
  • Processes may perform CPU bursts and I or O operations during their lifetime.


Concept / Approach:
In preemptive scheduling, the operating system can interrupt a running process and move it back to the ready queue so that another process can run. This preemption can occur on events such as a timer interrupt, when a higher priority process becomes ready, or when a time quantum expires in round robin scheduling. Preemption improves responsiveness and allows better control over fairness and priority. In non preemptive scheduling, once a process gains the CPU it keeps it until it either terminates or blocks for input or output. The scheduler cannot take the CPU away from a running process in the middle of a CPU burst. This simplifies implementation but can lead to long waiting times for other processes.


Step-by-Step Solution:
Step 1: Recall that preemption means that the scheduler may interrupt a running process and switch to another.Step 2: Recall that in non preemptive scheduling, a process continues its CPU burst until it finishes or blocks, without being forced off the CPU.Step 3: Compare the options and identify which one correctly states this contrast in control over the CPU.Step 4: Option A states that the operating system may forcibly take the CPU away in preemptive scheduling and that in non preemptive scheduling the process runs until it yields, which matches the definition.Step 5: The remaining options either confuse sharing with preemption or make incorrect claims about hardware.


Verification / Alternative check:
Examples help confirm the definitions. Round robin and preemptive priority scheduling are preemptive algorithms because the scheduler can interrupt a process when its time quantum expires or when a higher priority process arrives. First come first served and non preemptive shortest job first are non preemptive because once a job starts its burst, it runs until completion of that burst. These examples align with option A.


Why Other Options Are Wrong:
Option B incorrectly claims that preemptive scheduling does not involve sharing the CPU, but time sharing is common in preemptive systems.Option C links preemption to the number of cores, which is not part of the scheduling definition.Option D asserts specific performance guarantees that are not generally true; shortest job first can be implemented in preemptive or non preemptive forms and neither always guarantees perfect behaviour in realistic systems.


Common Pitfalls:
A frequent mistake is to think that preemptive scheduling always leads to better performance. While it improves responsiveness, it introduces overhead due to more frequent context switches. Another pitfall is to assume that non preemptive scheduling is never used. In fact, some real time and embedded systems prefer non preemptive schemes for simplicity and predictability.


Final Answer:
The correct answer is In preemptive scheduling the operating system may forcibly take the CPU away from a running process, while in non preemptive scheduling a running process keeps the CPU until it voluntarily releases it by terminating or blocking.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion