Course Outline
Concurrency challenges and problems
- Platform hardware limitations - hardware threads, pipes, cache coherence
- Elementary concepts related to multithreaded programming (multithreaded program correctness, lifetime, starvation, deadlock, race, atomicity, consistency models, Flynn's taxonomy)
- Mechanisms for implementing multithreading and multiprocessing available in C++.
- Standard library implementation - elements from C++14 to present (C++2a)
- Implementation available in Boost - differences from the standard library
Processes and threads
- Multiprocess and multithreaded applications
- Operating system and threads (a brief overview of available implementations)
- Process and thread synchronization mechanisms
- Structural implementation of synchronization
- Specificity of the implementation of multithreading in the object-oriented approach (role of the RAII pattern)
Memory model in language C++
- Objects and places in memory
- Scheduling operations and enforcing them
- Relations: synchronization, priming, ordering of operations for atomic actions, release sequences
- Memory barriers
- Atomic operations
Thread management in standard C++14 and newer
- The std::thread class and starting threads
- Thread identification
- Attaching and detaching a thread
- Threads and standard containers
- Exception handling in threads C++14
Mutual exclusion and critical sections
- Simple rules of mutual exclusion
- 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 derivatives
- RAII pattern for 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
- Operations on semaphores
- Recursive locks
- Locks with lock level definition
- Decision variables and interlock cooperation
- Implementation of active and passive barriers (Idle Waits, Busy Waits)
- Resuming threads
- Communication between threads (Actor and CSP model)
Asynchronous tasks
- Asynchronous events and their handling
- Future
- Promises (promises)
- Prepared tasks (packaged_task)
Atomic types
- Standard atomic types
- Universal atomic flag (std::atomic_flag)
- The std::atomic<T> class template and its specializations
- Utility functions (free) of types std::atomic
Specifics of multi-threaded API design
- Designing structures using interlocks - coarse and fine-grained interlocks
- Concurrent code performance - estimation and measurement techniques
- Data partitioning
- Scalability of solutions
- Handling errors and exceptional situations in the application architecture
Testing and debugging multi-threaded applications
- Code reviews for multi-threaded operations
- Specifics of testing multi-threaded applications
- Unit tests
- Increasing the probability of contingencies for testing
- Formal methods for testing multithreaded applications
- Multithreaded Application Architecture Patterns and Testing and Debugging (Overview)
Advanced thread management
- Dependent threads (Saga pattern)
- Avoiding competition in access to data
- Controlled stopping and interruption of the thread
- Interrupting blocking calls
- Interrupt handling
- Stealing tasks
- Interrupting tasks when the application ends
Multithreading design patterns
- Types and purpose of multithreaded patterns
- Scope of application of patterns
- Thread Pool
- Active Object Pattern
- Thread Safe Queue
- Producer Consumer Pattern
- Monitor pattern
- Multithreaded security patterns GoF
Requirements
- Ability to use software development tools in C++ in a GNU/Linux and/or MS Windows environment
- Knowledge of programming issues in C++ (procedural and object-oriented paradigm) at advanced and intermediate level
- Knowledge of creating generalized code (templates)
Testimonials (4)
theoretical introduction, examples of design patterns, discussion of problems with multithreading
Piotr - InsERT S.A.
Course - Programowanie wielowątkowe w języku C++
Machine Translated
1) Hands-on workshop sessions :)
Mariusz Szlagowski - Samsung Electronics Polska Sp. z o.o
Course - Programowanie wielowątkowe w języku C++
Machine Translated
Instructor has extensive knowledge and is enthusiastically interested in explaining various topics. He showed us great tools and the benefits of using the latest versions of C++. Thanks for directing us towards the possibility of optimization during the linking stage.
Krzysztof Guc
Course - Programowanie wielowątkowe w języku C++
Machine Translated
Tastes of the C++ language and conveying important messages 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