Get in Touch
 Duration 28 hours

Course Outline

Concurrency challenges and problems

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

Processes and threads

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

C++ memory model

  • Objects and memory locations
  • Ordering operations and enforcing them
  • Relations: synchronization, happening-before, ordering operations for atomic actions, release sequences
  • Memory barriers
  • Atomic operations

Thread management in C++14 standard and later

  • std::thread class and thread startup
  • Thread identification
  • Thread joining and detaching
  • 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
  • Brief introduction to time handling in C++14 (chrono library)
  • std::mutex, std::timed_mutex, std::shared_mutex classes and derivatives
  • 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 reader-writer problem
  • One-time initialization
  • Thread-local (private) memory (std::thread_local)

Locks and thread synchronization

  • Semaphore operations
  • Recursive locks
  • Locks with a defined locking level
  • Decision variables and cooperation with locks
  • Implementation of active and passive barriers (Idle Waits, Busy Waits)
  • Resuming thread operation
  • Inter-thread communication (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)
  • 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
  • Formal methods for testing multithreaded applications
  • Architecture patterns for multithreaded applications vs. testing and debugging (review)

Advanced thread management

  • Dependent threads (Saga pattern)
  • Avoiding contention in data access
  • Controlled stopping and interrupting threads
  • Interrupting blocking calls
  • Interrupt handling
  • Work stealing
  • Interruption of tasks during application shutdown

Design patterns for multithreading

  • Types and purposes 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

  • Proficiency in using software building tools in C++ in the GNU/Linux and/or MS Windows environment
  • Knowledge of C++ programming topics (procedural and object-oriented paradigms) at intermediate and advanced levels
  • Knowledge of generic code creation (templates)

Number of participants


Price per participant

Testimonials (1)

Upcoming Courses

Related Categories