~/talk

Locks are tricky — let's understand them by building one

Talkat NDC Melbourne 2022 · 2022-06-20..06-24· [concurrency]
slides:none on file

Explains why simple lock/lock keyword fails, demonstrates C# primitives (mutex, semaphore, Monitor) and lock-free Compare-and-swap loops, and shows a working memory-mapped file mutex that stores PID/TID, spins with timeouts and can kill stalled owners; runtime demos expose double-flush/finalizer corruption when Environment.Exit races with using, and deadlocks from killing threads or fork without exec. Recommends always acquiring locks with timeouts, avoid semaphores, refresh cloud leases, and cautions that async/await breaks traditional lock ownership; the custom mutex runs in production.

AI-written summary · about

  1. 0:00Start
  2. 2:35General Concepts
  3. 3:58Parallelism
  4. 4:44Concurrent Parallel
  5. 7:00Shared Memory versus Message Passing
  6. 10:24Word Tearing
  7. 12:05Critical Section
  8. 19:48How Should We Tag a Concurrency Primitive
  9. 22:25Monitor
  10. 23:08Monitor with Condition Variable
  11. 28:14Problems with Locks
  12. 29:18Always Acquire Your Locks with Timeouts
  13. 31:22Compare and Swap Operation
  14. 38:20Double Check Lock
  15. 41:32Dll Main Lock
  16. 43:50Isolation Level
  17. 44:22Isolation Levels
  18. 47:39Deckers Algorithm
  19. 50:00Caches and Memory Model
  20. 53:08Problem with Async
  21. 55:36Mutex
  22. 55:56Acquire a Lock with a Timeout
  23. 1:04:04Avoid Semaphores
  24. 1:04:58Resources
~/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.