Get in Touch
 Duration 28 hours

Course Outline

Concurrency Challenges and Problems

  • Hardware platform limitations - hardware threads, streams, cache coherency
  • Basic concepts related to multithreaded programming (correctness of multithreaded programs, lifetime, starvation, deadlock, race conditions, atomicity, consistency models, Flynn's taxonomy)
  • Mechanisms available in C++ for implementing multithreading and multiprocessing
  • Standard library implementation - elements from C++14 to the present (C++2a)
  • Implementation available in Boost - differences compared to the standard library

Processes and Threads

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

The C++ Memory Model

  • Objects and memory locations
  • Ordering operations and enforcing order
  • Relationships: synchronization, happens-before, sequencing operations for atomic actions, release sequences
  • Memory barriers
  • Atomic operations

Thread Management in C++14 and Later Standards

  • The std::thread class and launching threads
  • Thread identification
  • Thread joining and detaching
  • Threads and standard containers
  • Exception handling in C++14 threads

Mutual Exclusion and Critical Sections

  • Basic rules of mutual exclusion
  • Concepts (types) of available locking objects
  • A quick introduction to time handling in C++14 (the chrono library)
  • The std::mutex, std::timed_mutex, std::shared_mutex classes and derivatives
  • The RAII pattern in lock handling (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)

Locking and Thread Synchronization

  • Semaphore operations
  • Recursive locks
  • Locks with a defined lock level
  • Decision variables and cooperation with locks
  • Implementation of active and passive barriers (Idle Waits, Busy Waits)
  • Resuming thread activity
  • Inter-thread communication (Actor model and CSP)

Asynchronous Tasks

  • Asynchronous events and their handling
  • Futures
  • Promise objects
  • Packaged tasks (packaged_task)

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 and exception handling in application architecture

Testing and Debugging Multithreaded Applications

  • Code reviews regarding multithreaded operations
  • Specifics of testing multithreaded applications
  • Unit tests
  • Increasing the probability of failure scenarios for testing purposes
  • Formal methods for testing multithreaded applications
  • Architectural patterns of multithreaded applications vs. testing and debugging (overview)

Advanced Thread Management

  • Dependent threads (Saga pattern)
  • Avoiding race conditions in data access
  • Controlled thread stopping and interruption
  • Interrupting blocking calls
  • Interruption handling
  • Work stealing
  • Interrupting tasks during application shutdown

Multithreading Design Patterns

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

Requirements

  • Proficiency in using C++ software development tools in a GNU/Linux and/or MS Windows environment
  • Advanced and intermediate knowledge of C++ programming concepts (both procedural and object-oriented paradigms)
  • Familiarity with generalized code creation (templates)

Number of participants


Price per participant

Testimonials (1)

Upcoming Courses

Related Categories