← All resources

What Every Programmer Should Know About Memory

Blog Advanced

Ulrich Drepper

Visit resource ↗

Description

Ulrich Drepper's classic technical paper on how software interacts with modern memory hardware. The PDF hosted on people.freebsd.org (mirrored widely) is a book-length treatment originally published in November 2007 while Drepper was at Red Hat.

It explains commodity RAM types, memory controllers, CPU cache hierarchy, cache lines and associativity, virtual memory, NUMA, DMA, and how access patterns affect bandwidth. Later sections give concrete programming advice for layout, prefetching, and multithreaded access, plus tools for profiling memory behavior.

Advanced engine and systems programmers benefit when optimizing hot loops, asset streaming, or rendering data structures. Understanding why sequential access beats pointer chasing explains many real-world GPU-adjacent CPU bottlenecks in scene graphs and batch builders.

Free to download; LWN.net also serialized key chapters for online reading. The document targets Linux examples but the hardware concepts apply across platforms.

Widely regarded in systems programming as the essential reference for CPU cache and memory hierarchy behavior.