As CPU cores become both faster and more numerous, the limiting factor for most programs is now, and will be for some time, memory access. Hardware designers have come up with ever more sophisticated memory handling and acceleration techniques–such as CPU caches–but these cannot work optimally without some help from the programmer. Unfortunately, neither the structure nor the cost of using the memory subsystem of a computer or the caches on CPUs is well understood by most programmers. This paper explains the structure of memory subsystems in use on modern commodity hardware, illustrating why CPU caches were developed, how they work, and what programs should do to achieve optimal performance by utilizing them.
It is a rather dense reading with a plethora of details concerning how memory works and what a programmer should know in order to get the most out of it. Of course you are not gonna apply everything here in your daily job unless you are a HPC programmer. Still, this is a very interesting and informative reading for the ones who are dying out of curiosity to know how memory works in its innermost details. Drepper writes very well and this makes a enjoyable reading. There you will find things like memory ram basics. Caching, virtual memory, NUMA, programming techniques to extract the most out of the memory, memory tools that can expedite the optimization process.
This is not really a book but a paper. It focuses on lower system-level knowledge of computer memory and it is extremely helpful to understand the intricacies of the memory system to understand program behaviour and perform program optimizations. This paper offers a very good starting point in terms of a) illustrating the mechanisms of the memory system b) explaining important optimizations and c) introducing tools to understand the memory system.
I believe the paper deserves its title. Every programmer should know about what is in the paper. At 2019, this paper is only more relevant.
:) I don't think every programmer needs to know all these things!
It is great but very acronym heavy, and I constantly had to google for introductions to things he was describing some specific consequences of (e.g. NUMA, SMP). And this was written in late 2007! so I was often wondering whether what I was reading would still be relevant, so if you're wondering the same please know you can top it off with the updates in here !
This 95 page doc talks you through what DRAM and SRAM look like (on a transistor and capacitor level!!) and everything else you'd want to know about either of them; levels of CPU caches and how alignment and proximity in cache lines plays a role in program performance (turns out it's good to keep your commonly accessed together data stored close together in memory!); a bunch about things sharing resources (threads, hyperthreading, processors with shared memory, etc); a bunch about synchronization of things sharing memory (atomicity/transactions/CAS/LL/SC, the MESI protocol); things involved in virtualisation of memory; cool stuff about helping prefetching with __builtin_expect or its likely / unlikely macros :)
Книга (?) очень хорошо разжевывает работу cpu со своим кешем, с памятью, с соседними процессорами, как кеши остаются целостными, как поверх всего этого накручены атомарные операции и транзакционная память... Не уверен, что я запомнил хотя бы 25% информации, но когда где-то будут встречаться статьи с обоснованием низкоуровневого перформанса чего-либо, в голове будут всплывать нужные воспоминания :) Рекомендую к прочтению всем, кому интересно, откуда у процессора при большой нагрузке хватает времени и мультитредиться и поток операций паралелить и предугадывать что программа будет дальше запрашивать.
This paper, which is actually equal to a medium sized book, opened so many doors for me. I now understand a lot of things much better than I did but I think I have to read this a couple of more times to really understand this better.
Recommended for every systems programmer and anyone interested in performance.
Very classic content, and still free to read. It's been a long time coming, but the basics have not changed. I only read the first 5 chapters, and it gave me a lot of progress in my storage basics. I have plans to continue reading the rest of the book in the future.
Awesome book and I recommend for everyone want to understand how memory works .. to be honest I've read this book three times to understand all the various details/techniques covered in it.