Scheduling decides which runnable work receives CPU time. Policies balance throughput, response time and fairness under workload assumptions.
Before you start
You should understand processes, threads, memory and basic file operations. Track ownership and state changes over time. For concurrent scenarios, write down at least two possible execution orders; the same instructions can behave differently when scheduling or resource availability changes.
The practical goal is to reason through this situation: Interactive tasks benefit from timely execution rather than waiting behind long CPU jobs. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Choose workload goals
Interactive response and batch throughput can favor different policies.
Step 2: Trace short and long jobs
Concrete arrival times expose waiting and preemption tradeoffs.
Step 3: Include fairness
An attractive average can hide indefinitely delayed tasks.
Worked scenario
Interactive tasks benefit from timely execution rather than waiting behind long CPU jobs.
A long job arrives just before several short interactive tasks. Nonpreemptive execution makes every short task wait; time-sharing improves responsiveness but introduces switching overhead. Strict priority can help interactive work while starving maintenance unless the scheduling policy includes a progress mechanism.
Common mistake
Average completion time alone can conceal starvation or poor tail latency.
Verify the behavior
Calculate waits for the same small workload under two policies.
Interview exercise
Compare scheduling policies.
Answer and reasoning
Use a concrete mix of short and long tasks and discuss fairness, overhead and response distributions.
Continue learning
Compare the scenario with the Operating Systems interview questions and test your understanding with the Operating Systems MCQs. For terminology and implementation details, consult the reference material.