2 ms·
This is grossfully incorrect. Using sequential consistency on x86 does require extra expensive fence instructions. What's free on x86 is acquire/release.
by mgaunard 4y ago
This is grossfully incorrect. Using sequential consistency on x86 does require extra expensive fence instructions.
What's free on x86 is acquire/release.
- benreesman 4y agoYou're going to eat some cost on any speculative/out-of-order chip to get loads and stores ordered bidirectionally relative to getting it down to the `MFENCE` or whatever by hand, though a great deal less than not having a speculative execution pipeline. The statement you're calling "grossfully incorrect" was double-qualified by "IIRC" and "basically", which I thought was enough to make clear that I was oversimplifying a bit. The Google doc I linked starts with this: "Most engineers reach for atomic operations in an attempt to produce some lock-free mechanism. Furthermore, programmers enjoy the intellectual puzzle of using atomic operations. Both of these lead to clever implementations which are almost always ill-advised and often incorrect." They're being generous. I'm well aware that it gets up the ass of every self-styled Ghemawat to point out that most people shouldn't be playing jazz on this stuff, but if even one hacker doesn't fuck up something important because I urged some caution, I'll live.
- deleted 4y ago[deleted]