Ninety Nine Percent Trick
An MLFQ scheduler uses these rules:
- Rule 3: a new job enters at the highest priority.
- Rule 4a: a job that uses up its 10 ms allotment while running drops one queue.
- Rule 4b: a job that gives up the CPU before the allotment is up stays at the same priority, and its allotment is reset.
A user writes a job that runs for 9.9 ms, issues a one-byte write to a file, then loops.
| slice | CPU used before yielding | allotment used at exit | queue after |
|---|---|---|---|
| 1 | 9.9 ms | reset to 0 | top |
| 2 | 9.9 ms | reset to 0 | top |
| 3 | 9.9 ms | reset to 0 | top |
What does this job do to the CPU-bound jobs sitting in the lower queues?
Sign in to answer questions and track your progress
Sign In