1. Dashboard
  2. Table of Contents
⌘K
Resources
  • Roadmap
  • References
Curriculum
  • Memory
    • Table of Contents
    • 0.0 Introduction
    • 0.1 Bytes and addresses
    • 0.2 The physics of storage
    • 0.3 Latency vs bandwidth
    • 0.4 The memory wall
    • 0.5 Caches
    • 0.6 Locality
    • 0.7 Data layout
    • 0.8 Virtual memory
    • 0.9 How CPUs fight latency
    • 0.X Capstone: napkin math
  • GPU
  • CUDA
  • Inference

Topic 0 › Memory

Table of Contents

CPU land: no GPU in sight. By the end of this topic you can explain why a memory access costs what it costs, predict the cache behavior of simple code, and napkin-math the runtime of a loop before running it. Every later topic is a callback to what happens here.

  1. 0.0IntroductionWhy memory first: the three ideas that carry the whole curriculum.
  2. 0.1Bytes and addressesMemory is one giant byte array; a pointer is just an index into it.
  3. 0.2The physics of storageSRAM vs DRAM: why fast memory can't be big and big memory can't be fast.
  4. 0.3Latency vs bandwidthA pipe has a length and a width. They are different numbers with different costs.
  5. 0.4The memory wallCPUs got ~100× faster; DRAM latency barely moved. The hierarchy is the only way out.
  6. 0.5CachesLines, hits, misses, eviction, and why a miss always costs a full 64-byte line.
  7. 0.6LocalityThe same loop, two traversal orders, 25× apart. Spatial and temporal locality explain why.
  8. 0.7Data layoutAoS vs SoA, alignment, padding: layout is a locality decision you make at declaration time.
  9. 0.8Virtual memoryPages, page tables, TLBs: every address you've ever used was a fiction.
  10. 0.9How CPUs fight latencyPipelines, out-of-order, prefetching: the machinery that hides memory latency, until a dependency chain blocks it.
  11. 0.XCapstone: napkin mathLatency numbers everyone should know: predict memcpy and matrix-sum times, then measure.