#1 Yesterday 07:58:20

okoba
Member
Registered: 2019-09-29
Posts: 113

The Fastest Mutexes

This post may be interesting: https://justine.lol/mutex/
It is based on https://github.com/google/nsync

Last edited by okoba (Yesterday 07:58:48)

Offline

#2 Yesterday 09:21:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,548
Website

Re: The Fastest Mutexes

The problem with such claims is that the benchmark involved for measurement is really an unrealistic micro-benchmark.
Noone would use a mutex to incremenent an integer: we would all use an atomic increment instruction.

So what is measured here is the contention itself: when several threads try to acquire the lock.
In normal code, it should not appear often. Or you are locking too much content, or for too much time, or too often.
Most of the time, in real world, a well-defined mutex won't have contention: and all implementations rely on a CAS operation for this most simple case.

This is why we have several locks in mORMot.
https://blog.synopse.info/?post/2022/01 … e-Them-All

Offline

Board footer

Powered by FluxBB