Caches, performance, energy. Landauer's floor, and Goodhart's law for everything you measure.
Instructions, as the profiler counts them. Emulation ×2,593, virtualization ×208, a context switch, a page fault, a system call: each a number selfie prints. Optimisations preserve meaning and change this.
Bytes mapped. A flat page table at 8 MB against a tree; a bump allocator that never reuses against a free list; a collector that keeps dead memory because it is reachable. Each a bound with a footprint.
Joules from the wall. The one currency with a law of physics attached, and the one a data centre actually pays. Comes at the end.
Decidable is not doable: the halting problem is not what stops a kernel from scheduling optimally or a collector from being precise; the budget is. Station IV, for a systems engineer, is the budget.
A processor cycle is a nanosecond; a memory access is a hundred. A cache keeps what was used recently, betting it will be used again. Selfie simulates L1 caches: over 99 percent hits for selfie compiling itself.
Same meaning, different cost: the cache is invisible to the program's semantics, so it can be tuned freely. And it leaks: a program that times itself can read what another cached. Isolation of meaning is not isolation of cost.
Lines, associativity, eviction: change them with selfie's options and watch the miss rate. That is the exercise.
Instruction mix, nops, system calls, page faults, timer interrupts, the hottest procedures and loops: selfie's profile of every run. Every number a design decision of this semester changed. Look at the nop share: the compiler class's optimisation week is about that line.
Measure before you optimise, and measure what the user pays, not what is convenient to count. A kernel that minimises context switches and maximises latency has optimised the wrong line. Which is the next slide.
Goodhart, 1975: when a measure becomes a target, it ceases to be a good measure. Benchmarks that compilers detect. Schedulers tuned for a throughput number until the interactive user leaves. Energy accounting that moves the joules to a different meter. Training to the benchmark.
A mature field needs notation, semantics, and a metric, and it needs to keep replacing the metric. The systems engineer's version: the profile is where the argument starts, not where it ends.
When a measure becomes a target, it ceases to be a good measure.Charles Goodhart, 1975
Landauer, 1961: erasing one bit costs at least kT ln 2 ≈ 3 × 10−21 joules, because two states become one and the lost distinction leaves as heat. Every overwrite is an erasure.
Just counting through a 266-bit space would cost 1059 joules, 1015 Suns. A data centre is a machine for forgetting at scale.
A brain runs on 20 watts. Intelligence can be done far more cheaply than it is, and that is a systems engineer's job.
Universality for systems: the halting problem in the scheduler, Rice on everything the kernel wants to know, and deadlock detection as the approximation it uses instead.
Strauss · Der Rosenkavalier — Carlos Kleiber, Vienna 1994. The Marschallin at the end of Act I: “Die Zeit, die ist ein sonderbar Ding”, and at night she stops all the clocks. Time is the currency this week, and she is the one who knows what it costs.
Feynman Lectures on Computation — Feynman: reversible computing and the thermodynamics of computation, Landauer’s limit included, in his own inimitable way. And, more technical, Irreversibility and Heat Generation in the Computing Process — Landauer, 1961: every step that forgets costs kT ln 2, in the paper that proved it.