English
Topic 9. Multithreaded programming in C++ and the parallel algorithms of the standard library
Goal: become familiar with the multithreading facilities of the C++ standard library and the parallel algorithms with execution policies; learn to create and build projects with CMake, presets, and Ninja, start std::jthread threads with cooperative cancellation, synchronize them with mutexes, condition variables, semaphores, and atomic variables, and obtain results through std::future; master measuring speedup and finding data races with ThreadSanitizer.
Lecture contents
- GCC, CMake, Ninja, and CLion — Tools: GCC, CMake, Ninja, and CLion · Building a project: CMake and Ninja
- Threads and synchronization in C++ — std::thread and std::jthread threads · Mutexes and locking · Condition variables, semaphores, latch, and barrier
- Atomic operations and asynchronous results — Atomic operations · Asynchronous results: async, future, promise · A thread pool
- Parallel algorithms and diagnostics — Parallel algorithms of the standard library · Finding bugs: ThreadSanitizer and the debugger · Measuring performance
- Examples and common mistakes — Program examples · Common mistakes