~/talk

Building more efficient locks

Talkat GCAP 2024 · 2024-10-07..10-09· [game-development]
links:none on file
slides:none on file

Shows a practical implementation that reduces a mutex to a single-byte lock using futex/parking-lot ideas and an embedded hashmap of per-address wait queues, so the uncontended path is one compare-and-exchange and contention hits an atomic wait/notify slow path (or a condition-variable fallback). Demonstrates pause/yield usage, compare_exchange weak vs strong choices, acquire/release atomics, and how to build condition variables, events and semaphores. Claims faster than spinlocks for uncontended cases, smaller memory footprint than OS mutexes, and requires heavy unit/soak testing and sanitizers.

AI-written summary · about

  1. 0:00Efficient locks intro
  2. 1:05Ideal lock traits
  3. 2:53Mutex with spinlock
  4. 4:41Cache coherence MESI
  5. 9:16Optimizing spinlocks
  6. 11:01Out-of-order execution
  7. 15:56Pause instruction
  8. 17:22Memory reordering risks
  9. 20:56Acquire/release ordering
  10. 23:29OS scheduler yielding
  11. 25:55Atomic wait/notify
  12. 29:02Parked bit for contention
  13. 31:52OS mutex fallback
  14. 33:58Atomic wait/notify impl
  15. 36:05Uncontended mutex opt
  16. 37:07CAS weak vs strong
  17. 39:55Condition vars with atomic wait
  18. 42:22Mutex summary parking lots
  19. 43:25Q&A: C++ std locks
  20. 45:32Q&A: Testing edge cases
  21. 47:00Q&A: CAS failure scenarios
  22. 48:28Q&A: Real-world testing
  23. 49:57Q&A: Memory ordering
~/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.