Computational Reality
A Bottom Up View of the MachineWelcome to the machine.
This is not a book about code. This is a book about the physics of information. We will trace the journey of a single bit from a miserable existence as a trapped electron in a capacitor, through the violence of the Arithmetic Logic Unit, across the frozen wastelands of Main Memory, and finally to the glowing output of your screen.
We do not learn by reading definitions. We learn by seeing things break. Every chapter in this book includes a Live Simulator that proves the physics. You will not just read about a Cache Miss; you will watch the CPU stall and feel the cost of distance.
Table of Contents
Part 0: The Preamble
- 00. The Lie Why code is a high-level abstraction that betrays you.
Part I: The Switch
- 01. The Switch Managing electricity with the MOSFET.
- 02. The Logic Gate Freezing time to create certainty.
- 03. The Clock The heartbeat that synchronizes chaos.
- 04. Memory (State) Trapping electrons to store the past.
Part II: The Wiring
- 05. The Bus The cost of moving information.
- 06. The Adder Making rock think.
- 07. The Program Counter The illusion of sequence.
- 08. The Instruction Decoding the machine's language.
- 09. The CPU Putting it all together.
Part III: The Operating System
- 10. The Hierarchy Why distance is time. L1, L2, L3, RAM.
- 11. The Cache Line The atomic unit of data movement.
- 12. The Watcher (Prefetch) Predicting future memory access.
- 13. Translation (Virtual Memory) The lie of virtual address space.
- 14. Coherence (MESI) The cost of sharing truth between cores.
Part IV: Negotiation
- 15. Gravity (Stacks) The path of least resistance (Hot Cache).
- 16. Waiting Lines (Queues) Buffering against bursty reality.
- 17. Fragmentation (Lists) The cost of scattering data.
- 18. Probability (Hashes) Trading space for constant time.
- 19. Hierarchy (Trees) Organizing chaos for search.
Part V: The CPU
- 20. The Factory Throughput vs Latency.
- 20.5. I-Cache Feeding the beast with instructions.
- 21. Illusion of Order Out-of-Order execution and hazards.
- 22. The Oracle Branch Prediction mechanics.
- 23. When Oracle Fails The cost of misprediction flushes.
- 24. The CPU Learns You Dynamic branch history.
Part VI: Algorithms
- 25. Why Looking Hurts Linear search and cache misses.
- 26. Why Halving Works Logarithmic physical reach.
- 27. Why Order Fails Sorting, swapping, and entropy.
- 28. Why Distance Lies Pointer chasing vs Arrays.
- 29. When Structure Collapses Graph traversal costs.
Part VII: Entropy
- 30. Entropy Always Wins Memory fragmentation mechanics.
- 31. Divide and Suffer Allocators and free lists.
- 32. The Page Is the Atom OS-level memory management.
- 33. Thrashing When disk becomes RAM.
Part VIII: The Front-End Lie
- 34. The Other Cache Instruction locality matters.
- 35. Decode Is Not Free The CISC tax and Micro-ops.
- 36. The History Tables Prediction is just memory.
- 37. When Learning Breaks Adversarial patterns and randomness.
Part IX: Using Memory to Cheat
- 38. Using Memory to Cheat Side channels and timing attacks.
- 39. Arithmetic Intensity Why GPUs win: Computation per byte.
- 40. Libraries Are Weapons Crystallized performance (BLAS).
- 41. Nothing Is Free The Triangle of Doom.