Memory Barriers Are Like Source Control Operations
If you use source control, you’re on your way towards understanding memory ordering, an important consideration when writing lock-free code in C, C++ and other languages. In …
If you use source control, you're on your way towards understanding memory ordering, an important consideration when writing lock-free code in C, C++ and other languages. In my last post, I wrote about memory ordering at compile time , which forms one half of the memory ordering puzzle. This post is about the other half: memory ordering at runtime, on the processor itself. Like compiler reordering, processor reordering is invisible to a single-threaded program. It only becomes apparent when lock-free techniques are used - that is, when shared memory is manipulated without any mutual exclusion
saved by
related reading
- Who ordered memory fences on an x86? | Bartosz Milewski's Programming Cafebartoszmilewski.com
- Linux kernel memory barriers — The Linux Kernel documentationdocs.kernel.org
- What Every Programmer Should Know About Memorypeople.freebsd.org
- C++11 Memory Modelpeople.cs.pitt.edu
- research!rsc: Hardware Memory Models (Memory Models, Part 1)research.swtch.com
- The "Basics" | Putting the "You" in CPUcpu.land
- What Every Programmer Should Know About Memoryakkadia.org
- A Concurrency Cost Hierarchytravisdowns.github.io
- On the GPU Memory Hierarchygytis.co
- C++ Memory alignment - should we care? - Stack Overflowstackoverflow.com
- A very concrete explanation of how a cache worksparksb.github.io
- The Lost Art of Structure Packingcatb.org