🧠 What is Non-Preemptive Scheduling?

In Non-Preemptive Scheduling, once a process is given the CPU, it keeps it until it finishes or voluntarily gives it up (e.g., by waiting for I/O).

πŸ›‘ The OS never interrupts a running process, even if a higher-priority process arrives.


🧩 How It Works

Process P1 starts running β†’
P2 arrives (higher priority) β†’
P1 keeps running β†’
Only after P1 finishes, P2 gets CPU

There’s no forced context switch. The OS simply waits.


πŸ•°οΈ When Is the CPU Released?

  • The running process terminates

  • The process moves to waiting state (e.g., waiting for I/O)


βœ… Advantages of Non-Preemptive Scheduling

βœ… BenefitπŸ“˜ Why It Matters
🧠 Simple to implementNo need for complex interrupt handling
πŸ” Low overheadFewer context switches (less CPU time wasted)
πŸ’Ύ PredictableGood for batch systems and embedded environments
πŸ”’ Safer for shared resourcesNo risk of being preempted while holding a lock

❌ Disadvantages

❌ IssueπŸ“˜ Explanation
πŸ•’ Poor responsivenessSlow for interactive or real-time systems
🧊 CPU hoggingLong processes block shorter, urgent ones
⚠️ Starvation possibleImportant tasks may be delayed indefinitely
πŸ“‰ Low CPU utilizationIf a process blocks on I/O, CPU may sit idle

πŸ“Š Common Non-Preemptive Scheduling Algorithms

AlgorithmHow It Works
First-Come First-Served (FCFS)Run processes in order of arrival
Shortest Job First (SJF)Run the shortest total burst time process first
Priority Scheduling (Non-Preemptive)Run the highest-priority ready process β€” but don’t preempt current one

🧠 Interview-Ready Definition:

Non-Preemptive Scheduling is a CPU scheduling approach where once a process starts executing, it runs to completion or until it voluntarily releases the CPU. It’s simple and predictable, but less responsive β€” making it unsuitable for real-time or interactive systems.


πŸ–₯️ Real-World Analogy

Imagine a railway crossing where once a train starts crossing, it must finish completely before another is allowed β€” even if an ambulance is waiting.

That’s non-preemption.


πŸ”„ Summary Table: Preemptive vs Non-Preemptive

FeaturePreemptiveNon-Preemptive
🧠 Interruptibleβœ… Yes❌ No
πŸ•’ Response Timeβœ… Fast❌ Slow
πŸ” Context Switch OverheadHighLow
βš–οΈ FairnessBetterCan lead to starvation
🧰 Use CaseInteractive/real-timeBatch/embedded systems