Lock-Free Programming in Modern C++ | ACCU 2017

Added:

Intro & Basics
Memory & Atomics
Atomic Use Cases
SPSC Queue Code
Multi-Consumer Issues
MPMC Final Code

Intro & Basics

0:09
Playing Section
  • 1

    Defines lock-free programming as synchronization without locks, critical for real-time systems.

  • 2

    Explains why locks fail in real-time contexts due to blocking, unbounded waits, and priority inversion.

  • 3

    Distinguishes between block-free (some progress) and wait-free (all progress) guarantees.

Fundamental multithreading in C++, including threads, mutexes, condition variables, and avoiding basic data races.
Basic CPU architecture concepts, such as cache hierarchies, cache coherency protocols, and hardware-level instruction reordering.
Familiarity with standard data structure implementations, particularly linked lists and FIFO queues.
The concept of atomic operations and the limitations of traditional lock-based synchronization.
Deep dive into C++ memory ordering semantics, specifically distinguishing between sequentially consistent, acquire-release, and relaxed memory orderings.
Advanced memory reclamation techniques in lock-free programming, such as Hazard Pointers and Epoch-Based Reclamation (EBR) to safely handle the ABA problem.
Designing and analyzing other complex lock-free and wait-free data structures, such as lock-free stacks, deques, and flat-combining structures.
Performance profiling and benchmarking of concurrent algorithms under high thread contention using tools like Google Benchmark, Intel VTune, or perf.
19.6K views256likes1:31:34@ACCUConfOriginal Release: 2017-05-05

Lock-free programming enables thread-safe data sharing without locks, which is essential for real-time systems where blocking operations are unacceptable; modern C++ provides std::atomic as a portable, thread-safe generic type that implements lock-free operations through atomic load/store/exchange/compare_exchange member functions, allowing developers to implement lock-free data structures like queues that guarantee progress without mutual exclusion, though implementing such structures requires careful handling of memory ordering, compare-exchange patterns, and understanding the distinction between atomic and lock-free guarantees.