What every programmer should know about memory [pdf] (people.freebsd.org)
recommended by 2 users | 2023 | 2 points by quackulus | performance | original thread |
2 users recommended this thread. What they said:
rramadass Jul 25, 2026 | on: A concrete explanation of how a cache works | context

Caches and Memory Systems have to be looked at from three related perspectives viz. a) Hardware/SoC/Physical level b) OS/Compiler system software level c) Applications usage level.

To that end;

1) Buy/Beg/Borrow/Steal the Curt Schimmel book mentioned above. That one book will teach you all about how OSes manage caches/memory for SMP multiprocessing systems. You really get to understand multiprocessing at a fundamental level.

2) Memory Systems: Cache, DRAM, Disk by Bruce Jacob et al. - Old classic and a comprehensive book on all aspects of memory systems. Supplement with papers on newer technologies as needed.

3) Ulrich Drepper's classic What every Programmer should know about Memory - https://news.ycombinator.com/item?id=36420502

4) Cache-Oblivious Algorithm - https://en.wikipedia.org/wiki/Cache-oblivious_algorithm See in particular, Harald Prokop's thesis on the above linked to under "References" section.

5) Cache-aware Programming pattern from the book Game Programming Patterns - https://gameprogrammingpatterns.com/data-locality.html

6) There are lots more resources on cache-aware programming and using compiler builtins to help you do it. Here is a list of tips - https://johnnysswlab.com/make-your-programs-run-faster-by-be... This website has a lot of info. on all aspects of memory optimization.

7) AoS and SoA - https://en.wikipedia.org/wiki/AoS_and_SoA

anonymoushn Jun 27, 2023 | on: Optimizing a Ring Buffer for Throughput | context

you can read the oft reposted What Every Programmer Should Know About Memory[0]. I also wrote a comment about this sort of thing recently which includes more links[1].

[0]: https://news.ycombinator.com/item?id=36420502

[1]: https://news.ycombinator.com/item?id=33760117