
Master the fundamentals of concurrency and multithreading with modern C++. Learn safe thread creation, synchronization of shared resources, and practical exercises with sequence diagrams to visualize multithreaded code.
Learn the theory of concurrency and practical multithreading in modern C++, with straight or maneuvering paths and a toolset including GCC 12.1, MSVC 19.42, VSCode, and Draw.io.
Explore why concurrency emerged from sequential programming, time sharing, and parallelism, and learn how concurrent programming enables safe, efficient multithreading in modern C++.
Explore the hardware perspective of concurrency, contrasting von Neumann and Harvard architectures, and learn Flynn's taxonomy with MI SD, SIMD, and Mimd memory models.
Explore how software perspective and hardware perspective intersect to enable concurrent execution through threads, execution contexts, tasks, and schedulers, comparing parallel processing and time-sharing models.
Discover the multithreaded programming paradigm within concurrency, where software tasks become threads bound to the operating system's scheduler via execution contexts and shared memory.
Overview of multithreaded programming challenges, focusing on portability and partition ability; it illustrates partitioning a billion-integer sum and non-partitionable tasks like burning a disk image.
Explore race conditions in multi-threaded C++ applications by examining how concurrent access to shared resources can cause behavioral and data anomalies, including read-modify-write issues and memory order problems.
Explore time-of-check to time-of-use bugs in multithreaded programs, illustrated by a printer scenario, and learn how mutual exclusion and automaticity prevent race conditions.
Explore read-write-modify race conditions where threads load, modify, and write back shared data, and how mutual exclusion preserves atomicity. See how two threads might overwrite each other's results without synchronization.
Explains data races as simultaneous reads and writes on shared data, causing corruption or inconsistency, and highlights false order of memory update alongside atomic access and synchronization tools like mutexes.
Explore synchronization mechanisms that prevent race conditions and false memory updates, using mutual exclusion, atomic operations, and messaging and execution coordination to ensure thread-safe access to shared resources.
Explore how improper synchronization causes deadlocks in multithreaded C++ programs. Compare deadlock avoidance with detection and recovery, including fixed resource ordering and run-time management.
Explore how false sharing causes unnecessary cache traffic and how to prevent it with memory padding, alignas, and cache line alignment using destructive and constructive interference sizes.
Explore how modern C++ threads bind a task body to an independent software thread via std::thread and the C++20 thread class, using execution contexts and schedulers.
Explore initializing std::thread with functions, lambdas, and functors, using default and variadic constructors, and manage join and detach with value and reference arguments.
Explore the joinability of modern c++ threads, comparing join and detach, and visualize lifecycles from inactive to active to non joinable.
Explore the lifetime phases of std::thread in modern C++, including inactive, active joinable, and active non-joinable states. Learn how join, detach, and move semantics manage these threads.
Identify and prevent common std::thread misuses, including joining or detaching non joinable threads, dangerous detaching with dependencies, and destroying joinable threads, with practical safeguards.
Explore common std::thread misuses in modern C++, and learn safe destruction of joinable threads through raii guards or the C++20 thread class with cooperative cancellation concepts.
Explore modern C++ inter-thread synchronization, covering mutual exclusion, atomic operations, and execution coordination with mutexes, condition variables, stop tokens, futures, promises, async, packaged_task, semaphores, latches, barriers, and coroutines.
Explore how modern C++ mutexes enforce mutual exclusion in multithreaded apps, illustrated by a shared bathroom and two threads simulating Jack and John.
Explore the untimed category of modern C++ mutexes, including the DCD mutex, the DCD recursive mutex, and the std shared mutex, and their lock, trylock, and unlock operations.
Explore timed mutexes in modern C++, extending non-timed mutexes with try_lock_for and try_lock_until, including timed, recursive timed, and shared timed mutexes in a real-world Olga, Jack, and Joan scenario.
Explore modern C++ mutex locking with RAII: lock guards, unique_lock, shared_lock, and scoped_lock, plus lock and trylock functions to prevent deadlocks and misuse.
Compare std::lock_guard and std::unique_lock in modern c++ RAII locking, noting lock_guard's simple constructor/destructor behavior and unique_lock's adopt_lock, try_lock, and timed options.
Explore the std::shared_lock for shared locking with shared mutexes, contrasting it with std::unique_lock for exclusive locking. Learn RAII locking, constructor forms, trylock usage, and automatic unlock through destructors.
Explains std::scoped_lock, a multi-lock RAII mechanism that locks multiple resources. Demonstrates the scope_lock class template and its logging strategy to avoid deadlocks in a DVD writer and reader scenario.
Explore standard modern c++ non-raii mutex locking function templates, including lock and trilogue, and how they compare to raii options like unique_lock and shared_lock for multi-lock safety.
Explore how modern C++ ensures atomic access to shared data through mutexes, locks, or std::atomic, and contrast explicit and implicit synchronization with lock-free and lock-based approaches.
Learn how modern C++ atomics enable safe, lock-free access to shared data with std::atomic, exploring type traits, lock-free status, and atomic operations for built-in and user types.
Explore the types of atomic variables in modern C++, including standard specializations for integral, character, floating point, and pointer data, plus atomic flag.
Explore a multithreaded simulator that models a three-hose probe-drogue aerial refueling system, using atomic states and threads to monitor connections, control valves, and testing scenarios.
Learn the five generic atomic operations in the primary atomic class template, including load, store, exchange, compare_exchange_weak, and compare_exchange_strong, and how they enable memory-order aware, lock-free concurrency.
Explore a lock-free air defense system simulator that uses atomic compare-exchange operations to manage a 40-target lock-free array, coordinating detection, tracking, and missile launching across multiple threads.
Explore C++20 value based signaling interfaces for atomic variables, including wait and notify operations, how they coordinate threads through changes, and the ABA problem making them not recommended for synchronization.
Explore modern c++ condition variables and their role in execution coordination, using wait and notify interfaces with mutexes and predicates to synchronize threads.
Examine the six waiting functions of modern C++ condition variables, comparing wait, wait for, and wait until with and without predicates, timeouts, and spurious wakeups.
Explore the producer consumer pattern in modern C++ using a condition variable, atomic req id and execute flags, and waitfor timeouts with notify one/all in multi-thread test with 19 consumers.
Deepen multithreading in modern C++, modeling a probe and drogue aerial refueling system with atomic variables, hosts, hoses, and lambda-driven thread simulations.
Explain how std::call_once with std::once_flag coordinates across threads to ensure a function executes only once, using a shared flag and handling exceptions.
Learn how a shared flag and a function template ensure that only one callable executes among multiple threads, coordinating execution across a set of callables.
Explore the lazy initialization technique in modern C++, delaying resource initialization until first use, and address thread safety and race conditions in multithreaded contexts.
Explore cooperative thread cancellation in modern C++, including termination flags, probe checks, and safe patterns with mutexes, condition variables, and the three C++20 stop-state approaches for std and thread instances.
Learn the C++20 stop state mechanism, including standalone and built-in stop states, and how stop_source, stop_token, and stop_callback enable cooperative thread cancellation and condition_variable integration.
Explore how to implement C++20 stop-state based thread cancellation using standalone stop state mechanisms with stop_source, stop_token, and optional stop_callback, and how built-in stop state in std::thread enables cooperative cancellation.
Learn to cooperatively cancel a class member function call initiated by a std::jthread using standalone and built-in C++20 stop state mechanisms, including a counters class and count_seq.
Explore the C++20 latches, barriers, and semaphores as inter-thread coordination mechanisms, detailing their signaling interfaces, counting and waiting behaviors, and practical usage in multi-threaded code.
Explore the C++20 std latch, a single-use downward counter with countdown, arrive and wait, and try_wait interfaces, dramatically differing from barriers and semaphores for coordinating thread execution.
Explore the C++ 20 barrier in depth, comparing it with the latch and semaphore, and learn how arrival tokens, phase resets, and a compilation function enable reusable synchronization in multithreading.
Examine the C++20 semaphore design, including the upward downward counter and signaling interfaces, and contrast it with the barrier, covering acquire, release, try acquire, and timed variants.
Explore c++20 semaphores, including counting and binary variants, with mutual exclusion and signaling interfaces, acquire and release semantics, and common use cases like resource access, producer-consumer, and wait-notify.
Explore resource access limitation in C++20 semaphores by modeling a shared resource with a three-slot counting semaphore, using try_acquire, acquire, and release across four threads.
Explore multithreading with c++20 semaphores through a hands-on coffee machine demo that uses four drink makers, a resource controller, and producer-consumer requests via request receiver and handler.
Many developers write multithreaded code.
But few truly understand it!
━━━━━━━━━━━━━━━━━━━━━
Enjoy The Fundamentals of Multithreading with Modern C++
━━━━━━━━━━━━━━━━━━━━━
A course built to develop a genuine multithreaded programming mindset — combining deep theory, hands-on C++20 development, professional UML modelling, and the mastery of developing multithreaded applications with various levels of complexity.
Here's what you'll walk away with:
A firm theoretical foundation
Concurrency from both hardware and software perspectives. Memory models, hazard patterns, synchronization semantics — understood, not just memorized.
Practice on compelling real world project
Learn through projects that demand real concurrency thinking:
Probe-Drogue Aerial Refueling Simulator — thread coordination under strict mid-flight timing constraints
Air Defense System Simulator — parallel threat detection & interception under latency pressure
Coffee Machine Manager — threads competing for a shared everyday coffee machine device
Daily-life concurrency scenarios — Simulating the concurrent activities of flatmates including their exclusive and shared usage of domestic shared resources
C++20 Multithreading Features
Go beyond C++11 threads. Master the modern toolkit:
jthread
latch
barrier
semaphore
UML modelling for concurrent systems
Design and model thread lifelines, synchronization events, and message-passing flows with UML Sequence Diagrams.
Advanced concepts and Design Patterns
The course doesn't stop at the basics. You'll go through:
Deadlocks — reason through circular waits, and apply lock ordering & std::scoped_lock to eliminate them
Lock-Free Data Structures — atomic CAS loops, and building a lock-free data structure that never block
Lazy Initialization — defer expensive construction safely with std::call_once
Producer–Consumer Pattern — bounded queues, backpressure, and multi-producer/multi-consumer use-cases
Readers–Writers Pattern — maximise read throughput with std::shared_mutex while preventing writer starvation
If you're an intermediate C++ developer who wants to reason about concurrency (not just survive it), this course is for you!