More Concurrent Thinking in C++: Beyond the Basics
More Concurrent Thinking in C++: Beyond the Basics is a two-day onsite training course with programming examples, taught by Anthony Williams of Just Software Solutions. It is offered at the Gaylord Rockies from 09:00 to 17:00 Aurora time (MDT), on Saturday and Sunday, September 10th and 11th, 2022 (immediately prior to the conference). Lunch is included.
Course Description
Threads and locks are just the basics of multithreaded code. It is important to know how to use these fundamental building blocks, but they are just that: building blocks. This class is for those looking to move to the next level, at high level library and application design.
In this workshop you will learn how to use the basic building blocks to build better reusable abstractions that can simplify the high level code: thread pools, actors, and executors. This will include issues to watch out for when writing and using such abstractions, and how to avoid them.
You will learn about the new multithreading facilities being introduced to upcoming versions of the C++ Standard and how they will simplify your life as a library or application developer.
You will encounter the issues surrounding scalability, the pitfalls that arise when you run code designed for small numbers of cores or increasingly large numbers of cores, and how to design your code to minimize the problems.
Finally, you will also be shown how to test multithreaded code, including the use of tools like Thread Sanitizer.
There will be exercises throughout the workshop.
Prerequisites
Students are expected to have a good knowledge of C++, and familiarity with the C++11 standard thread library.
Students will require a laptop with one of the following compilers to handle the example code:
- Microsoft Visual Studio 2017 or later.
- gcc 7 or later
- clang 5 or later
Course Topics
- Thread pools and tasks
- How to write a thread pool. Potential issues with thread pools.
- Task allocation strategies such as work stealing.
- Managing lifetimes with concurrent tasks
- New C++20 facilities
- Cooperative cancellation
- Latches and barriers
- Semaphores
- atomic_ref
- atomic wait and notify
- Actors
- Using actors and message-passing to simplify concurrent code.
- New facilities from future C++ Standards:
- RCU and hazard pointers
- Executors, senders and receivers
- Testing concurrent code
- How to test multithreaded code, including the use of tools like Thread Sanitizer
- Scalability
- Writing code that works across a wide range of systems, or scales as the system grows.
- Atomics and lock-free code
- Refresher on the C++ memory model, and how to write lock-free code.
Register Here
Anthony Williams
Anthony Williams’ primary area of expertise is in the development of multi-threaded applications and libraries in C++. Anthony is the author of C++ Concurrency in Action, published by Manning. He is a UK-based developer and trainer with over 20 years of experience in C++.
Anthony has been an active member of the BSI C++ Standards Panel since 2001, and is author or coauthor of many of the C++ Standards Committee papers that led up to the inclusion of the thread library in the C++11 Standard. He continues to work on new facilities to enhance the C++ concurrency toolkit, both with standards proposals, and implementations of those facilities.
Anthony lives in the far west of Cornwall, England, where he currently spends most of his time developing automotive software for Woven Planet.