Concurrent Thinking in C++
Our two-day Concurrent Thinking in C++ workshop helps your developers get up to speed on the multithreading and concurrency support in the C++ Standard Library, as well as providing guidance on how to use it correctly, and how to design multithreaded applications.
One of the most difficult issues around designing software with multiple threads of execution is synchronizing data. Whether you use actors, active objects, futures and continuations or mutable shared state, every non-trivial system with multiple threads needs to transfer data between them. This means thinking about which data needs to be processed by which thread, and ensuring that the right data gets to the right threads in the right order. It also means thinking about API design to avoid race conditions.
In this workshop we'll look at techniques we can use when doing this "thinking", as well as the tools we have available to help us describe our requirements and enforce them in code.
All examples will use C++, but the thought processes are widely applicable.
This workshop will cover:
- The C++ memory model and happens-before
- We will look at the ordering guarantees provided by various constructs, and how we can use them to provide synchronization between threads.
- Race conditions and data races
- We will look at the difference between a generic race condition and a data race, identifying race conditions, and avoiding them.
- Mutexes and condition variables
- Using mutexes to protect data, and avoiding the common pitfalls with condition variable usage.
- Futures and promises
- Using futures to synchronize actions, and pass data between threads.
- Atomic operations and lock-free code
- Lock-free code isn't just about avoiding mutexes. We will look at correctly synchronizing concurrent actions with atomic operations.
- Designing APIs for concurrent usage
- There's more to supporting concurrent usage of an API than merely wrapping the body of each function in a lock. We will look at race conditions inherent in some API designs, and how to avoid them in our own code.
Contact us to book this workshop.