Locks are tricky

We’re often told that message passing is better than sharing the memory and protecting it with critical sections. But why? Can’t we just use lock keyword and call it a day? What can go wrong?

In this talk we’ll delve into concurrency primitives to understand how they work and what risks they bring. We’ll understand async magic. Finally, we’ll build a couple of custom primitives, for both non-async and async world in C#. There will be quite a lot of interlocked operations, memory mapping, and observing how pieces flow between threads.

Materials

Slides

Concurrency Part 1 – Mutex performance in .NET

Recordings


Presented at