Live data from Hacker News

Understanding Memory Reordering

internalpointers.com

1–2 of 2 posts

Re: Understanding Memory Reordering

#2
Whenever you read "lock-free", think "locking in microcode". These atomic operations trigger hardware state machines that work remarkably similarly, in character, to what happens for a lock, and are often little faster. But they are quite a lot harder to get right.

If you think you need lock-free, usually what you really need is less contention, or a single-writer ring buffer.

Sometimes lock-free is right, and sometimes locking is right. But it can be worth quite a lot to find a way not to need either one.