Explain the difference between preemptive and non-preemptive scheduling. When would you prefer one over the other?
Last updated
Non-preemptive scheduling lets a process keep the CPU until it blocks or finishes; preemptive scheduling can forcibly take the CPU away (e.g. on a timer interrupt or a higher-priority arrival). Preemptive gives better responsiveness and fairness; non-preemptive is simpler and has less switching overhead.
Non-preemptive:
CPU released only voluntarily (process terminates or blocks on I/O).
Simple, low context-switch overhead, no race conditions from mid-execution interruption, but one long job can starve others (poor response time).
Preemptive:
OS reclaims the CPU via timer or priority changes; enables time-sharing.
Better response time and fairness, but more context switches and needs careful synchronization of shared data.
When to prefer each:
Preemptive: interactive and real-time systems where responsiveness matters.
Non-preemptive: simple batch systems, or embedded contexts where predictability and low overhead are valued.
- https://growthequityinterviewguide.com/firms/b-capital
- https://www.interviewbit.com/sre-interview-questions/
- https://www.reddit.com/r/cscareeradvice/new/
- https://www.reddit.com/r/macbook/comments/1jg7fl6/24gb_ram_enough_for_software_engineering/
- https://www.reddit.com/r/infosys/comments/1t71add/anyone_received_round_2_mails/
- https://www.reddit.com/r/cscareeradvice/best/
- https://www.reddit.com/r/LeetcodeChallenge/
- https://www.reddit.com/r/infosys/comments/1t71i55/infosys_specialist_programmer_april_26_1st_round/
- https://www.reddit.com/r/programming/comments/1hqo19u/static_search_trees_40x_faster_than_binary_search/
- https://medium.com/@avinashkumar808482/operating-system-interview-questions-2026-0db6b4674980
- https://lmskkhsou.in/eservices/e-Resources/Resources/NEP%20Syllabus%202024/core/BCA_Syllabus.pdf