← Back to Library
What Every Programmer Should Know About Memory
Published2007
Pages114
LanguageEnglish

What Every Programmer Should Know About Memory

by Ulrich Drepper

About this Book

Written by Ulrich Drepper (former lead maintainer of glibc), this paper is considered legendary across systems engineering. It is universally acclaimed as the single most important document for engineers building low-latency, high-throughput software. Drepper meticulously breaks down commodity computer hardware: DRAM cell architecture, memory controllers, and bus topologies. CPU cache hierarchy is explored across L1 instruction/data, L2, and L3 caches, detailing cache line size, associativity, and replacement. The mechanics of cache misses, cache invalidation protocols (MESI), and bus contention are analyzed with precise hardware metrics. Virtual memory management, Translation Lookaside Buffers (TLB), huge pages, and multi-level page tables are thoroughly demystified. It teaches practical code optimization techniques: structure layout, loop tiling, prefetching, and vectorization (SIMD). NUMA (Non-Uniform Memory Access) systems and multi-socket server memory distribution are explored with kernel affinity controls. Multi-threaded cache pollution, false sharing, and lock-free atomic operations are discussed with concrete C/assembly examples. Essential study for any engineer working on high-frequency trading, game engines, database kernels, or large-scale cloud services.