Course Outline
Concurrency Challenges and Issues
- Hardware platform limitations - hardware threads, pipelines, cache coherence
- Basic concepts related to multithreaded programming (program correctness, liveness, starvation, deadlock, race conditions, atomicity, memory models, Flynn’s taxonomy)
- Available mechanisms for implementing multithreading and multiprocessing in C++
- Standard library implementation - elements from C++14 to the present day (C++2a)
- Implementation available in Boost - differences compared to the standard library
Processes and Threads
- Multiprocess applications vs. multithreaded applications
- Operating system and threads (brief overview of available implementations)
- Synchronization mechanisms for processes and threads
- Structural implementation of synchronization
- Specifics of implementing multithreading in an object-oriented approach (role of the RAII pattern)
C++ Memory Model
- Objects and memory locations
- Ordering operations and enforcing them
- Relations: synchronization, precedence, operation ordering for atomic actions, release sequences
- Memory barriers
- Atomic operations
Thread Management in C++14 and Later
- The std::thread class and thread launching
- Thread identification
- Attaching and detaching a thread
- Threads and standard containers
- Error handling in C++14 threads
Mutual Exclusion and Critical Sections
- Simple mutual exclusion rules
- Concepts (types) of available locking objects
- Quick introduction to time handling in C++14 (chrono library)
- Classes std::mutex, std::timed_mutex, std::shared_mutex and their derivatives
- RAII pattern in lock management (std::lock_guard, std::unique_lock)
- Deferred and recursive locks (std::lock)
- Lock ownership and thread co-ownership
- The reader-writer problem
- One-time initialization
- Thread-local memory (private) (eng. std::thread_local)
Locks and Thread Synchronization
- Semaphore operations
- Recursive locks
- Locks with blocking level definition
- Decision variables and cooperation with locks
- Implementation of active and passive barriers (eng. Idle Waits, Busy Waits)
- Resuming thread execution
- Inter-thread communication (Actor model and CSP)
Asynchronous Tasks
- Asynchronous events and their handling
- Futures
- Promises
- Prepared tasks (eng. packaged_task)
Atomic Types
- Standard atomic types
- Universal atomic flag (std::atomic_flag)
- "std::atomic<T>" class template and its specializations
- Tool functions (free) of std::atomic types
Designing Multithreaded API Specifics
- 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 for multithreading operations
- Specifics of testing multithreaded applications
- Unit tests
- Increase the likelihood of failure scenarios for testing
- Formal methods for testing multithreaded applications
- Multithreading application architecture patterns and testing and debugging (review)
Advanced Thread Management
- Dependent threads (Sagi pattern)
- Avoiding data access contention
- Controlled thread stopping and interruption
- Interrupting blocking calls
- Handling interruptions
- Task stealing
- Interrupting tasks during application shutdown
Multithreading Design Patterns
- Types and purposes of multithreading patterns
- Scope of pattern applications
- Thread pool (eng. Thread Pool)
- Active object pattern (eng. Active Object)
- Thread-safe queue (eng. Thread Safe Queue)
- Producer-consumer pattern (eng. Producer Consumer)
- Monitor pattern (eng. Monitor)
- Multithreading safety of GoF patterns
Requirements
- Ability to use tools for building software in C++ in the GNU/Linux and/or MS Windows environment
- Knowledge of programming concepts in C++ (both procedural and object-oriented paradigms) at an advanced and intermediate level
- Understanding of generic code creation (templates)
Testimonials (5)
Practical examples
Jan Kaniuka - SIEC BADAWCZA LUKASIEWICZ - PRZEMYSLOWY INSTYTUT AUTOMATYKI I POMIAROW PIAP
Course - Programowanie wielowątkowe w języku C++
theoretical introduction, examples of design patterns, discussion of multithreading issues
Piotr - InsERT S.A.
Course - Programowanie wielowątkowe w języku C++
Machine Translated
1) Workshop nature of the course :-)
Mariusz Szlagowski - Samsung Electronics Polska Sp. z o.o
Course - Programowanie wielowątkowe w języku C++
Machine Translated
The trainer has knowledge and is actively interested in explaining various topics. He showed us cool tools and the advantages of using new C++ versions. Thank you for pointing out the possibility of optimization at the linking stage.
Krzysztof Guc
Course - Programowanie wielowątkowe w języku C++
Machine Translated
Delicacies of the C++ language and passing on important insights that can only be acquired through experience.
Krzysztof Kruk - GMV Innovating Solutions Sp. z o.o.
Course - Programowanie wielowątkowe w języku C++
Machine Translated