C++
developers, architects
3 days
lecture
workshop

Today, C++ software is increasingly asynchronous and parallel, a trend that is likely only to continue going forward. While the C++ Standard Library has a rich set of concurrency primitives and lower-level building blocks, we lack a standard framework for asynchrony and parallelism that C++ programmers desperately need.

Asynchrony and parallelism appear everywhere, from processor hardware interfaces to networking, to file I/O, to GUIs, to accelerators. Every C++ domain and every platform needs to deal with asynchrony and parallelism, from scientific computing to video games to financial services, from the smallest mobile devices to your laptop to GPUs in the world's fastest supercomputer.

This training aims to teach not only the C++ Standard Library threading and synchronization low-level tools but also provides an excellent introduction to structured concurrency with C++ Coroutines and a new framework called Senders/Receivers proposed for standardization as a part of C++26.

During the workshop, we will work with the latest compiler version thanks to the Compiler Explorer, so no special environment preparation is needed.

TRAINING HIGHLIGHTS

  • Overview of the "old" concurrency facilities introduced from C++11 up to C++17
  • Learning new concurrency facilities provided with C++20
  • Understanding what structured concurrency is and how it helps in writing thread-safe code without the need for additional synchronization
  • A detailed discussion of coroutine machinery and its suspend and customization points
  • Introduction of schedulers, senders, and receivers abstractions, as well as an overview of all the asynchronous algorithms provided by the Sender/Receiver framework

TRAINING AGENDA

The following plan is an initial proposal for the training material. The final agenda is always created based on the individual pre-training analysis of the client's requirements and constraints.

  1. Concurrency in the C++ Standard Library
    1. Different kinds of concurrency
    2. Parallelism vs Concurrency
    3. Parallel algorithms
    4. Synchronized buffered ostreams
    5. std::thread
    6. std::jthread and std::stop_token
    7. Mutexes
    8. Structuring code for protecting shared data
    9. Locks
    10. Deadlocks
    11. Monitor design pattern
    12. std::call_once and std::once_flag
    13. std::condition_variable
    14. concurrent_queue
    15. Semaphores
    16. std::latch
    17. std::barrier
    18. Futures
    19. std::async
    20. std::packaged_task
    21. std::promise
  2. Asynchronous Programming with Coroutines
    1. Coroutine keywords, restrictions, suspend points
    2. Coroutine return type
    3. std::coroutine_traits
    4. Coroutine promise interface
    5. std::coroutine_handle
    6. Awaiters and Awaitables
    7. Symmetric Control Transfer
    8. C++ exceptions support
    9. Eager and Lazy Tasks
    10. async with coroutines
    11. sync_await
  3. Structured Concurrency with Senders and Receivers
    1. Motivation
    2. The structure of an asynchronous processing pipeline
    3. Data parallelism with senders
    4. Cancellation support
    5. Transferring the work
    6. Sender factories
    7. Sender adaptors
    8. Sender consumers
    9. Implementing an asynchronous algorithm
    10. Sender/Receivers and Coroutines
C++
developers, architects
3 days
lecture
workshop

Trainer

Mateusz Pusz
FOUNDER / C++ TRAINER
Active Voting WG21 Member and Contributor to the C++ Standard