Get in Touch
 Duration 28 hours

Course Outline

Concurrency Challenges and Problems

  • Hardware platform limitations - hardware threads, pipelines, cache coherency
  • Fundamental concepts related to multithreaded programming (correctness of multithreaded programs, liveness, livelock, deadlock, race condition, atomicity, memory models, Flynn's taxonomy)
  • Available C++ mechanisms for implementing multithreading and multiprocessing
  • Standard library implementation - features from C++14 to the present day (C++2a)
  • Boost implementation - differences compared to the standard library

Processes and Threads

  • Multiprocess vs. multithreaded applications
  • Operating system and threads (brief overview of available implementations)
  • Mechanisms for process and thread synchronization
  • Structural implementation of synchronization
  • Specifics of multithreading implementation in an object-oriented approach (the role of the RAII pattern)

Memory Model in C++

  • Objects and memory locations
  • Operation ordering and enforcement
  • Relationships: synchronization, ordering, ordering of operations in favor of atomic actions, release sequences
  • Memory barriers
  • Atomic operations

Thread Management in C++14 and Newer Standards

  • std::thread class and thread execution
  • Thread identification
  • Attaching and detaching threads
  • Threads and standard containers
  • Exception handling in C++14 threads

Mutual Exclusion and Critical Sections

  • Basic principles of mutual exclusion
  • Concepts (types) of available locking objects
  • Quick introduction to time handling in C++14 (chrono library)
  • std::mutex, std::timed_mutex, std::shared_mutex classes and derivatives
  • RAII pattern in lock management (std::lock_guard, std::unique_lock)
  • Dependent and deferred locks (std::lock)
  • Ownership and co-ownership of locks and threads
  • The readers-writers problem
  • One-time initialization
  • Thread-local (private) memory (std::thread_local)

Locks and Thread Synchronization

  • Semaphore operations
  • Recursive locks
  • Locks with defined locking levels
  • Decision variables and cooperation with locks
  • Implementation of active and passive barriers (Idle Waits, Busy Waits)
  • Resuming thread execution
  • Communication between threads (Actor model and CSP)

Asynchronous Tasks

  • Asynchronous events and their handling
  • Futures
  • Promises
  • Packaged tasks

Atomic Types

  • Standard atomic types
  • Universal atomic flag (std::atomic_flag)
  • The "std::atomic<T>" class template and its specializations
  • Utility (free) functions for std::atomic types

Specifics of Multithreaded API Design

  • Designing structures using locks - coarse-grained and fine-grained locks
  • Performance of concurrent code - estimation and measurement techniques
  • Data partitioning
  • Scalability of solutions
  • Error handling and exception situations in application architecture

Testing and Debugging Multithreaded Applications

  • Code reviews for multithreaded operations
  • Specifics of testing multithreaded applications
  • Unit tests
  • Increasing the probability of failure scenarios for testing purposes
  • Formal methods for testing multithreaded applications
  • Multithreaded application architecture patterns and testing/debugging (overview)

Advanced Thread Management

  • Dependent threads (Saga pattern)
  • Avoiding data access contention
  • Controlled thread stopping and interruption
  • Interrupting blocking calls
  • Handling interrupts
  • Task stealing
  • Interrupting tasks during application shutdown

Multithreading Design Patterns

  • Types and purpose of multithreading patterns
  • Scope of pattern application
  • Thread Pool
  • Active Object pattern
  • Thread-Safe Queue
  • Producer-Consumer pattern
  • Monitor pattern
  • Multithreading safety of GoF patterns

Requirements

  • Ability to use software build tools for C++ in the GNU/Linux and/or MS Windows environment
  • Knowledge of C++ programming topics (procedural and object-oriented paradigms) at an advanced and upper-intermediate level
  • Knowledge of generic coding topics (templates)

Testimonials (1)

Related Categories