Website Logo. Upload to /source/logo.png ; disable in /source/_includes/logo.html


thoughts on tech, programming, parallelism etc.,

Getting Started With Memory Consistency

When I initially started learning about memory consistency, I found it full of intricacies and it was pretty involved. There are quite a few resources which helped me get up to speed. These are the ones I refer to whenever I am confused about anything related to consistency. I am listing them here and I hope you find it equally useful.

The first document I would recommend would be “Memory Barriers: a Hardware View for Software Hackers” by Paul McKenney. This is a lucid introduction describing some of the hardware structures which cause consistency issues to arise. It mainly boils down to optimizations implemented in hardware to reduce the cost of memory accesses being the cause.

Next would be to read Jeff Preshing' blog which has quite some articles for those interested in parallel programming. I would recommend these three articles in particular: 1, 2, 3.

Once you get a basic understanding of consistency and fences, the next article would be the Linux kernel’s memory-barriers.txt. This document goes into quite some depth explaining the various ordering dependencies which arise in current processors and how to use memory barriers to ensure consistency. You should also see the barrier.h header file for different architectures.

You should also read “A Tutorial Introduction to the ARM and POWER Relaxed Memory Models”. As the title says it talks about the ARM and POWER memory models. Another tutorial worth reading is “Shared Memory Consistency Models: A Tutorial”.

I will keep updating this post with any new articles I find interesting. Hope you enjoy them!