‹ All Operating Systems questions

Operating Systems Practice Question 3: Round Robin Time Slice

Operating Systems · Test 1 · question 3 of 10

CPU Schedulingmedium

An OS uses round-robin scheduling. To make interactive programs feel snappier, an engineer cuts the time slice from 10 ms to 0.5 ms. Each context switch costs about 0.5 ms once the save/restore work and the resulting cache and TLB misses are counted.

What is the most likely effect on a machine running many CPU-bound jobs?

Select one answer
Show answer and explanation

Answer:

  • A. Roughly half of CPU time is now spent switching, so total useful throughput drops sharply

Round robin runs each job for one time slice and then context-switches to the next. A shorter slice improves response time, every job gets the CPU again sooner, but each switch has a fixed cost. With a 10 ms slice and ~0.5 ms switch, about 5% of time is overhead. With a 0.5 ms slice, every 0.5 ms of useful work is paired with 0.5 ms of switching, so around half of the CPU is wasted. OSTEP calls this the time-slice trade-off: the slice must be long enough to *amortize* the switch cost without being so long that the system stops being responsive. The switch cost includes not just saving and restoring registers but also the cold caches, TLB and branch predictors afterwards.

Option B is wrong: fairness of the share does not make the overhead free. Every job still gets an equal share of a much smaller amount of useful CPU time.

Option C is wrong: shortening the slice *improves* response time; that is the whole reason to do it. The cost shows up as overhead, not as longer waits between turns.

Option D is wrong: round robin has no rule that skips jobs; it cycles through every runnable job, which is why plain round robin does not starve anyone.

Reference: OSTEP - Scheduling: Introduction

Practice Test 1 ›