Chapter Three · The Machine

The Machine

The processor as ideas, not as a datasheet. Six topics climb from the tower of layers under a line of Python, through gates that add, the loop every processor runs and the stack that makes function calls work, to the tricks a modern core uses to go fast and the reason chips stopped getting faster per core.

6 topics

A line of Python looks like one step. Underneath it sit bytecode, an interpreter, an instruction set, circuits, gates and switches, each keeping a simple promise to the layer above and each spending some of the machine's speed to keep it. This chapter walks down that tower once, so that every later chapter can name the floor a cost comes from.

The walk goes from the bottom up. Switches become gates, gates become an adder, and an adder with registers and a program counter becomes a machine that fetches, decodes and executes instructions forever. Function calls turn out to be jumps plus a stack of frames, which is also where recursion runs out of room. Then the chapter shows how a real core cheats: it runs dozens of instructions at once, guesses the outcome of every branch, and pays when it guesses wrong.

It ends on the change that shaped every program written since the mid-2000s. Clock speeds stopped rising, and the extra transistors went into more cores, wider vector units and accelerators, all of which help only work that is shaped to use them. There is no assembly language anywhere in the chapter: registers, pipelines and stacks are drawn, and x86 and ARM are named, never taught.

From a switch to a fast machine
Gatesswitches that add
→
Instructionsone loop
→
Callsthe stack
→
Speedin parallel

Topics in This Chapter