Skip to content

The Timer Takes It Back

Exercise: 60k_preemption (extra credit) · Fri Dec 4 · Length: 6:39 · Reading: Week 15 · The scheduler finally has work · Explainer: The Timer Takes It Back

A narrated walk through the explainer, for before Friday's session (Dec 4), to go with the Week 15 reading fork, wait, and the User Shell, for the extra credit: a timer tick that interrupts user code can take the CPU away from the process that was running. After its turn that process stays Runnable, and round robin runs the next one. The video reads the path a tick takes from a program that never makes a system call into the kernel and back, then steps through four example processes that spin on the reference kernel, tick by tick, watching each one's slice counter and who holds the CPU. The skeleton follows, where the ticks reach the kernel and the CPU never changes hands; then the given program rr, typed under cargo run on four kernels, one recorded line each. The video ends on what you write, the test's own programs, and the lines it printed for the reference, the skeleton and kernels A and B. It shows no solution code: only the slice counters, each process's state and who holds the CPU at each tick, with example processes, or the test's own.

Download the video (MP4, 9 MB) · Captions (WebVTT) · All eleven Week 15 videos