Systems Engineering · week 1

What is Selfie?

The talk, then the spine of the semester in an hour — weighted to the third command.

↑ Systems Engineering

What this class is for

Isolation is the semantic problem of systems. Virtualization buys performance by introducing self-reference. What a kernel cannot decide, it bounds.

Three sentences, and the class is their derivation: fourteen weeks of building hypster, selfie's hypervisor, into an operating system.

The purpose is shared with the companion classes: principles deep enough to position generative AI, and whatever comes next, properly.

The assignments

Ten autograded extensions of selfie, from an assembler to a lock-free stack. In week 10 a new one: a model checker finds the input that breaks your own systems code.

The book

What is Intelligence? The Computing chapter is this class. Read the Introduction and the Selfie chapter this week.

The axis

One line carries the semester.

the six stations, and where a systems class dwells

Countable. The machine, its privilege levels and exceptions, the assembler as a regular language. Weeks 2 and 3: everything still decidable.

Uncountable. Isolation. Memory, time, and the kernel that must isolate itself. Weeks 4 to 9: paging, scheduling, self-hosting, processes, threads, garbage collection — and Gödel, Turing and Rice at each of them.

Cost. Verifying systems code with a solver, and the price of everything in caches, cycles and joules. Weeks 10 and 11. Then universality for systems, agents as processes, and the definition.

Three commands, three theorems

Understand the third and you understand operating systems.

$ ./selfie -c selfie.c -o selfie1.m -m 2 -c selfie.c -o selfie2.m && diff -s selfie1.m selfie2.m $ ./selfie -c selfie.c -o selfie.m -m 2 -l selfie.m -m 1 $ ./selfie -c selfie.c -o selfie.m -m 3 -l selfie.m -y 2 -l selfie.m -y 1
Self-compilation · a fixed point

The compiler class. Here only its lesson: a system that agrees with itself has certified nothing, and the outside check is the rule.

Self-execution · the universal machine

An emulator that runs every program for its machine, itself included. The operating system by emulation, and the executable specification of the one by virtualization.

Self-hosting · the bootstrap problem

A hypervisor whose virtual machines can run the hypervisor. The kernel must be isolated from the things whose isolation it provides. Gödel's second theorem, run as an operating system. This class.

The thesis

An OS by emulation is semantically equivalent to an OS by virtualization.

two ways to build one operating system

By emulation the guest is read; by virtualization it is run, on the kernel's own processor. Same guest, same 86,380 instructions, same output. Only the host's bill differs: ×2,593 against ×208.

So virtualization is only for performance, bought with self-reference: the kernel needs what it provides.

Most courses show only the virtualized design and never name the loop. Here it is named first.

Fourteen weeks

The route.

wklectureassignment
2The machine again; the assemblerassembler-parser
3Emulation: mipster as universal machineself-assembler
4Virtual memory: paging—
5Time-sharing: the timer, schedulingprocesses
6Self-hosting: hypster, Gödel II, the TCBfork-wait
7Processes: fork, wait, exitfork-wait-exit
8Concurrency: threads, locks, lr/sclock, threads
wklectureassignment
9Runtime systems: malloc, garbage collectionthreadsafe-malloc
10Verifying systems code: rotor, bitmetreiber-stack, rotor-bounds
11Cost: caches, energy, Goodhart—
12Universality: halting, Rice, deadlock—
13Agents as processes: the gate—
14What a system is; the definition—
This week

Take a selfie.

  1. Install selfie, run the three commands, and set up the grader: private clone, upstream, commit links.
  2. Do print-your-name, prefixed like every other status message, and check it with the grader.
  3. Run make emu, make emu-emu and make os-emu, and write down the guest's and the host's instruction counts for each.
  4. Read the Introduction, the Selfie chapter, and the Computing chapter's opening callout.
Next week

The machine again, from the kernel's side: privilege, exceptions, system calls, machine contexts — and the assembler, which is your first assignment and a regular language.

After this week

Listen, then read.

Listen

Wagner · Das Rheingold — Boulez, Chéreau, Bayreuth. One E flat in the double basses, held for 136 bars, and the whole world of the Ring boots from it. The spine of a systems class: everything from one state, and the price paid for it later.

Read

Operating Systems: Principles and Practice — Anderson and Dahlin: the textbook of this class, kernels, processes, concurrency, memory and file systems, in depth. And, more technical, The UNIX Time-Sharing System — Ritchie and Thompson, 1974: the operating system in eleven pages, and the design taste every kernel since has copied.

SE 02 · The Machine, Again →