News for hackers. Stuff that matters.
Re:What every systems programmer should know about lockless ... by banachtarski on Thursday November 02, 2017 @06:03AM (#15609054)
Yup using a layer of indirection definitely works well. Regarding the futex, I definitely agree that most futex implementations on most hardware are designed to spin and resolve quickly in low contention scenarios, but this won't be true on all consoles/hardware/OS configurations. For certain cases (like a game engine), I'd be less inclined to rely on the futex to do the right thing.
Re:What every systems programmer should know about lockless ... by gpderetta on Thursday November 02, 2017 @06:33AM (#15609171)
Futex are a linux kernel-level specific waiting primitive [1]. The point of the OP is that mutex implemented on top of a futex has a purely userspace fast path that needs only a single CAS for each acquire and release in the uncontended space, so in this scenario an userspace spin-lock is not often significantly better (a spin lock release only need a store on some machines though). Spin locks are significantly worse in the contended space though.

[1] futexes enable Fast Userspace muTEXES, but futex themselves are kernel space and not particularly fast.

Re:What every systems programmer should know about lockless ... by chriscappuccio on Thursday November 02, 2017 @12:57PM (#15612123)
OpenBSD implements futex now, too. Major league userland responsiveness improvements for futex based mutexes.