Loading...
Trace slice boundaries and ready-queue order explicitly. Distinguish permanent priority classes from a feedback system that changes a job’s class during execution.
What you'll be able to do
Round robin gives a ready process up to a time quantum before it may be preempted and requeued. A process that finishes or blocks sooner does not need to use a full slice. For this example use A(0,4), B(1,3), C(2,1), quantum 2 and no overhead. At a slice boundary, enqueue arrivals at that time before requeuing the expired process.
A runs 0–2. B is already waiting and C arrives at 2, so the next queue is B,C,A. B runs 2–4 and has one unit left. C runs 4–5 and finishes. A runs 5–7 and finishes; B runs 7–8 and finishes. The explicit boundary convention matters: another stated ordering can produce a different valid timeline.
Completion times are A=7, B=8 and C=5. With the CPU-only waiting formula, the waits are 3,4 and 2, giving mean 3. B receives an earlier first response than under non-preemptive FCFS, but mean waiting is not automatically smallest. Response time, turnaround, fairness and throughput are different evaluation criteria.
A smaller quantum can improve opportunities for ready interactive work to receive service, but more frequent context switches can add overhead. A very large quantum can approach FCFS behaviour for short finite bursts. Do not assume an arbitrarily small quantum makes every job faster. Include the cost only when the question’s timing model supplies or requests it.
A multilevel queue separates work into queues, often by a fixed class such as interactive or batch. It needs rules for selection between queues and a policy within each queue. In one stated example, a higher-priority interactive queue preempts a lower-priority batch queue; the former uses round robin and the latter FCFS. Jobs do not move between classes merely because their last slice expired.
A low-priority job L needing five units starts at 0. A high-priority one-unit job H arrives at 2. Under this strict preemptive priority rule, L runs 0–2, H 2–3 and L 3–6. Persistent high-priority work could starve the lower queue. A multilevel feedback queue instead defines movement between levels; Pearson’s IAS name is multilevel queue, so do not silently import a feedback demotion rule.
| Policy/example | Timeline | Relevant rule |
|---|---|---|
| RR q=2 | A 0–2; B 2–4; C 4–5; A 5–7; B 7–8 | Arrivals before expired-job requeue |
| Fixed multilevel queues | L 0–2; H 2–3; L 3–6 | High class preempts low; no class migration |
Attempt the task before opening its worked response. Record each change of state, explain the rule used, and check the result against the original requirements. Code examples labelled Python 3 use that language’s conventions; pseudocode states its own assumptions.
Common mistakes to avoid
Key takeaways
Test yourself
Answer a few questions, then review anything you missed.
Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.