Thank you for sending your enquiry! One of our team members will contact you shortly.
Thank you for sending your booking! One of our team members will contact you shortly.
Duration 28 hours
Course Outline
Concurrency challenges and issues
- Hardware platform limitations - hardware threads, pipelines, cache coherence
- Elementary concepts related to multithreaded programming (correctness of multithreaded programs, liveness, starvation, deadlock, race conditions, atomicity, memory models, Flynn's taxonomy)
- Available mechanisms in C++ for implementing multithreading and multiprocessing
- Implementation of the standard library - elements from C++14 to the present day (C++2a)
- Implementation available in Boost - differences compared to the standard library
Processes and threads
- Multiprocess vs. multithreaded applications
- Operating system and threads (brief overview of available implementations)
- Synchronization mechanisms for processes and threads
- Structural implementation of synchronization
- Specifics of multithreaded implementation in the object-oriented approach (the role of the RAII pattern)
Memory model in C++
- Objects and memory locations
- Operation sequencing and enforcement
- Relationships: synchronization, happens-before, ordering of operations for atomic actions, release sequences
- Memory barriers
- Atomic operations
Thread management in C++14 and newer standards
- The std::thread class and thread execution
- Thread identification
- Joining 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 blocking objects
- Quick introduction to time handling in C++14 (chrono library)
- Classes std::mutex, std::timed_mutex, std::shared_mutex and derivatives
- RAII pattern in lock handling (std::lock_guard, std::unique_lock)
- Dependent and deferred locks (std::lock)
- Ownership and shared ownership of locks and threads
- Readers-writers problem
- One-time initialization
- Thread-local (private) memory (std::thread_local)
Locks and thread synchronization
- Operations on semaphores
- Recursive locks
- Locks with defined lock 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
- Free utility functions for std::atomic types
Specifics of designing multithreaded APIs
- 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 exceptional situations in application architecture
Testing and debugging multithreaded applications
- Code reviews focused on multithreaded operations
- Specifics of testing multithreaded applications
- Unit tests
- Increasing the likelihood of failure scenarios for testing purposes
- Formal methods for testing multithreaded applications
- Multithreaded application architecture patterns versus testing and debugging (overview)
Advanced thread management
- Dependent threads (Saga pattern)
- Avoiding contention in data access
- Controlled thread shutdown and interruption
- Interrupting blocking calls
- Interruption handling
- Task stealing
- Interrupting tasks during application shutdown
Multithreading design patterns
- Types and purposes of multithreading patterns
- Scope of pattern application
- Thread Pool
- Active Object pattern
- Thread-Safe Queue
- Producer-Consumer pattern
- Monitor pattern
- Multithread safety of GoF patterns
Requirements
- Ability to use C++ software build tools in the GNU/Linux and/or MS Windows environments
- Knowledge of C++ programming concepts (procedural and object-oriented paradigms) at an advanced or intermediate level
- Familiarity with generic programming concepts (templates)
Testimonials (1)
Practical examples