~/talk

Are mutexes slow?

Talkat Rustikon 2026 · 2026-03-19..03-20· [concurrency]
slides:none on file

Empirical test uses a shared counter: a mutex falls from about 300M ops/s on one thread to ~20M ops/s on two threads (≈10x collapse) because cache-coherency (the MESI protocol) forces cross-core cache-line invalidations (~30 ns each). A conventional reader-writer lock also collapses because readers update a shared counter. A left-right crate duplicates state, uses per-reader padded counters to avoid cache-line bouncing, scales linearly (up to ~150x faster versus RW-lock at many readers) but costs 2x memory, single writer semantics, and eventual-consistency trade-offs.

AI-written summary · about

  1. 0:00Mutex performance intro
  2. 1:06Testing shared counter
  3. 4:18Mutexes with multiple threads
  4. 8:55Reader-writer locks and writes
  5. 13:54Critical sections overhead
  6. 15:16Left-right data structure
  7. 24:22Choosing concurrency tool
  8. 27:29Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.