3 ms·
> You do need a fence in the unlock path though (at least a release fence). Well yes but on x86 that comes for free. The overhead of the full fence brought in
by ot 2y ago
> You do need a fence in the unlock path though (at least a release fence).
Well yes but on x86 that comes for free. The overhead of the full fence brought in by lock cmpxchg or lock xchg is in the order of ~10ns, which for an uncontended lock means that a mutex is almost 2x as slow as a spinlock.
A load acquire + store release would be a couple of ns (assuming everything in L1 etc...)