3 ms·
But the mutex encapsulates the int, so if the mutex ensured it occupied a multiple of cache lines, there would be no contention. At the very small cost of a few
by magicalhippo 1y ago
But the mutex encapsulates the int, so if the mutex ensured it occupied a multiple of cache lines, there would be no contention. At the very small cost of a few bytes of memory.
- gpderetta 1y agothe mutex forcing alignment would be extremely wasteful. FWIW, I have used 1-bit spin locks.