What is preemptive scheduling?
In preemptive scheduling, the operating system can forcibly suspend a running process and switch to another, usually using timer interrupts. This boosts responsiveness and fairness but adds context-switch overhead.
What is cooperative (non-preemptive) scheduling?
In cooperative scheduling, processes run until they finish or yield control voluntarily. The OS does not interrupt them, which simplifies implementation but can lead to long-running tasks hogging the CPU.
How do these approaches affect responsiveness and fairness?
Preemptive scheduling tends to improve responsiveness and reduce starvation by allowing the OS to interrupt busy processes. Cooperative scheduling relies on processes yielding, so a misbehaving process can block others.
Which strategies are typical examples of each approach, and when should you use them?
Preemptive examples include Round-Robin and priority-preemptive schemes; non-preemptive examples include FCFS. Use preemptive scheduling for general-purpose, interactive systems to ensure responsiveness; use cooperative scheduling in simple or tightly controlled environments where simplicity or determinism is desired.