Memory Orderings (LLO Archive)

Created 2025-11-30, last modified 2025-11-30

Part of my archive of Layover Linux Official posts on Tumblr.


2025-08-13

I'm finally starting to get my head around memory orderings in C++, but it's mainly serving to make me pissed off. No wonder people think concurrency is hard. It's normally not actually that hard to get concurrency right on a purely hardware model, but with an optimizing compiler reordering instructions basically at will, you get a whole extra layer of fuckery that you have to tame by asking nicely. And actually you have to ask nicely in 2+ separate places symmetrically for acquire vs release.

While I'm pretty far out from multithreading support in Prone, this is making me glad I'm committing to a bunch of architectural decisions that will make threading a lot simpler to do correctly.

So we'll see if I have to do anything crazy to avoid maladaptive compiler optimizations, but I think that's good groundwork to minimize the surface area for headaches.