On Wed Jul 10 00:18:13 2024 +0000, Alfred Agrell wrote:
An unconditional syscall in the wake path? I'm pretty sure that will make it slower than pthread mutex. I completely agree with benchmarking and testing this thing before de-drafting it. I don't trust eyeball measurements for this kind of stuff, I suspect they'll measure mostly placebo.
@Alcaro I don’t quite understand you here, because futex_wake should wake up one listener who fell asleep while lock. Perhaps I made a mistake somewhere, but I looked at other people's atomic lock implementations. It is unlikely that the code will be slower than pthread because pthread uses expensive scheduler context switching. We can remove futex from the code, but then we will waste extra CPU cycles. But yes, we need to come up with tests.
https://inria.hal.science/hal-01236734/document https://github.com/tchajed/futex-tutorial/tree/main