An interactive book

Down to the Metal

How a modern computer really works, built up from first principles: from a single switch to the programming language you write.

Start with Chapter 1 →
  1. Programming languages Part VIII
  2. Operating system Part VII
  3. Machine code & assembly Parts II · VIII
  4. Memory, storage, I/O, video Parts III–VI
  5. Processor (CPU) Part II
  6. Logic gates & adders Part I
  7. Transistors: switches Part I

Each layer is built only from the layers below it.

Every computer, from the original IBM PC to the phone in your pocket, is built from layers. Each one hides the messy details of the layer beneath and offers something simpler to the layer above. This book climbs that ladder one rung at a time. We never use an idea before we've built it.

You don't just read about each idea, you play with it. Flip switches, wire gates, step a processor one clock tick at a time, and watch an interrupt pause a running program. When we reach real hardware we use x86-64, the architecture that grew out of the IBM PC's 8088, and compare it with RISC-V, a clean modern design.

It's written in the spirit of the classic books, like Peter Norton's Inside the IBM PC, that taught a generation what was going on inside the box. No background is needed, only curiosity.

Contents

Part ISwitches and Logic

  1. 1From Switches to AdditionReady
  2. 2Numbers in Binary: Negatives, Overflow and HexReady
  3. 3Memory from Feedback: Latches and Flip-FlopsReady
  4. 4Clocks, Registers and CountersReady

Part IIThe Processor

  1. 5Meet Tiny-8, Our Toy CPUReady
  2. 6Fetch, Decode, ExecuteReady
  3. 7Instructions: From Tiny-8 to x86-64 and RISC-VReady

Part IIIMemory

  1. 8RAM and the Address BusReady
  2. 9Caches: Keeping Data CloseReady
  3. 10Virtual Memory and PagingReady

Part IVTalking to the World

  1. 11I/O Ports and Memory-Mapped I/OReady
  2. 12InterruptsReady
  3. 13DMA and Modern Buses: PCIe and USBReady

Part VStorage

  1. 14From Spinning Disks to SSDsReady
  2. 15File SystemsReady

Part VIVideo

  1. 16Framebuffers: From Text Mode to PixelsReady
  2. 17GPUs and ShadersReady

Part VIIBringing It to Life

  1. 18Booting: Firmware, UEFI and the BootloaderReady
  2. 19The Operating System KernelReady
  3. 20Processes, Scheduling and System CallsReady

Part VIIIProgramming

  1. 21x86-64 Assembly (with RISC-V)Ready
  2. 22The Stack and Calling ConventionsReady
  3. 23Compilers and LinkersReady
  4. 24Interpreters, Virtual Machines and Garbage CollectionReady

Part IXThe Modern Machine

  1. 25Pipelines and SpeculationReady
  2. 26Multicore and ConcurrencyReady
  3. 27Networking: From Bits on a Wire to the WebReady
  4. 28Accelerators: GPUs, NPUs and BeyondReady