Search⌘ K
AI Features

Case Studies

Understand how to apply C++ concurrency theory through real-world case studies. Learn different ways to calculate vector sums, ensure thread-safe singleton initialization, and optimize code step-by-step using the CppMem tool to verify multithreading behavior.

After presenting the theory of the memory model and the multithreading interface, I will apply the theory in a few case studies.

  • Calculating the Sum of a Vector

Calculating the sum of a vector can be done in various ways. You can do it sequentially, or concurrently with maximum and minimum sharing of data. The performance numbers differ drastically.

  • Thread-Safe Initialization of a Singleton

Thread-safe initialization of a singleton is the classical use-case for thread-safe initialization of a shared variable. There are many ways to do it, with varying performance characteristics.

  • Ongoing Optimization with CppMem

I will start with a small program and successively improve it, and verify each step of my process of ongoing optimization with CppMem. CppMem is an interactive tool for exploring the behavior of small code snippets using the C++ memory model.