3 ms·
I'm terrified of lock-free stuff because it typically depends on nasty things like memory order, cache behavior and other subtle things, mostly nonportable and
by kabdib 11y ago
I'm terrified of lock-free stuff because it typically depends on nasty things like memory order, cache behavior and other subtle things, mostly nonportable and simply awful to get right on a new platform.
Also, I keep finding bugs in lock free structures. That's annoying.
- raverbashing 11y agoThis is the kind of thing you abstract on a library
- kabdib 11y agoExcept that libraries are written by people, who have assumptions and probably limited budgets, and the sheer inventiveness of hardware engineers at making things like memory ordering different, or even buggy [game consoles are famous for this] . . . well, libraries aren't magic. You have to test them somewhere, and the failures are often subtle, happen sporadically, are hard to reproduce and are very difficult to debug. I've used them. But in limited areas, where the win is great and they are explicitly called out as portability hazards, with alternate implementations of the areas in case the lock-free stuff goes pear-shaped. And from time to time we look at these things and wonder if the performance gain is (a) real, and (b) worth the headache.
- bsder 11y ago> I'm terrified of lock-free stuff because it typically depends on nasty things like memory order, cache behavior and other subtle things, mostly nonportable and simply awful to get right on a new platform. Not really. Most lock free stuff relies on a single compare-and-swap or memory barrier instruction. Even the cheap microcontrollers have them these days. > Also, I keep finding bugs in lock free structures. That's annoying. I recommend you leave programming now. :) I have yet to find a library that doesn't have bugs.