English
Topic 4. Thread-safe collections, channels, and the producer–consumer pattern; false sharing
Goal: become familiar with .NET thread-safe, immutable, and blocking collections and System.Threading.Channels; learn to perform atomic compound operations and build bounded producer–consumer pipelines with correct completion; master detecting and eliminating false sharing through measurement.
Lecture contents
- Collections and nonblocking algorithms — Ordinary collections in a multithreaded program · Nonblocking algorithms
- Concurrent and immutable collections — Concurrent collections · ConcurrentDictionary · Immutable and frozen collections
- The producer–consumer pattern and channels — The BlockingCollection class · The producer–consumer pattern · System.Threading.Channels
- Caches, false sharing, and profiling — CPU caches and data locality · False sharing · Choosing a data structure · Measurement and profiling
- Examples and common mistakes — Program examples · Common mistakes