Based on my book "Concurrency with Modern C++" educative.io created an interactive course. You can have it now at a discount of 38 %.
"Modern C++ Concurrency" is a interactive journey through current and upcoming concurrency in C++.
- C++11 and C++14 have the basic building blocks for creating concurrent or parallel programs.
- With C++17 we got the parallel algorithms of the Standard Template Library (STL). That means, most of the algorithms of the STL can be executed sequential, parallel, or vectorized.
- The concurrency story in C++ goes on. With C++20 we can hope for extended futures, coroutines, transactions, and more.
How to Get it?
Use the link to educative: Modern C++ Concurrency: Get the most out of any machine
What's Inside?
- 140 lessons
- 110 code playgrounds => Run in browser
- 78 code snippets
- 55 illustrations
This interactive course explains you the details to concurrency in modern C++ and gives you, in addition, more than 100 running code examples. Therefore you can combine the theory with the practices and get the most of it.
Because this interactive course is about concurrency, I present a lot of pitfalls and show you how to overcome them.
Give me the Details!
If you are curious and you should be, here are the details to the more than 300 pages:
-
Introduction
- Guide to Follow this Course
-
A Quick Overview
- C++11 and C++14: The FoundationPreview
- Multithreading in C++Preview
- Case StudiesPreview
- C++17: Parallel Algorithms of the Standard Template LibraryPreview
- C++20: The Concurrent Future
- Challenging Issues in C++
-
Memory Model: The Contract
- The Contract
- The Foundation & Challenges
-
Memory Model: Atomics
- Strong Memory Model
- Weak Memory Model
- The Atomic Flag
- Spinlock vs. Mutex
- std::atomic<bool>
- User Defined Atomics
- All Atomic Operations
- Free Atomic Functions
- Atomic Operations on std::shared_ptr
-
Memory Model: Synchronization and Ordering Constraints
- Introduction
- Types of Synchronization & Ordering Constraints
- Sequential Consistency
- Acquire Release Semantic
- Is Acquire-Release Semantic Transitive?
- Acquire Release: The Typical Misunderstanding
- std::memory_order_consume
- Data dependencies with std::memory_order_consume
- Relaxed Semantic
-
Memory Model: Fences
- Fences as Memory Barriers
- The Three Fences
- Acquire Release Fences
- Synchronization with Atomic Variables
- Synchronization with Fences
-
Multithreading: Threads
- Introduction to ThreadsPreview
- Creation of Threads
- Managing Thread Lifetime
- Thread Lifetime Management: Warnings and Tips
- Passing Arguments to Threads
- Arguments of Threads: Undefined behavior
- Arguments of Threads - Race Conditions and Locks
- Methods of Threads
- Methods of Threads in Practice
-
Multithreading: Shared Data
- Introduction to Shared Data
- Introduction to Mutexes
- Mutex Types and Locking Methods
- Issues of Mutexes: Deadlocks
- Issues of Mutexes: Avoiding Exceptions
- Types of Locks: std::lock_guard
- Types of Locks: std::unique_lock
- Types of Locks: std::shared_lock
- Thread-Safe Initialization
- Thread-Safe Initialization: Constant Expressions
- Thread-Safe Initialization: call_once and once_flag
- Thread-Safe Initialization - Static Variables with Block Scope
-
Multithreading: Local Data
- Thread Local Data
-
Multithreading: Condition Variables
- Condition Variables
- The Caveats of Condition Variables
-
Multithreading: Tasks
- Introduction to Tasks
- Threads vs Tasks
- Introduction to std::async
- async: Start Policy
- async: Fire and Forget
- async: Concurrent Calculation
- Introduction to std::packaged_task
- Introduction to Promises and Futures
- Promise and Future : Return an Exception
- Promise and Future: Return a Notification
- Introduction to std::shared_future
-
Case Study: Calculate Sum of a Vector
- Introduction
- Single Threaded Summation: Ranged Based for Loops
- Single Threaded Summation: Addition with std::accumulate
- Single Threaded Summation: Protection with Locks
- Single Threaded Summation: Protection with Atomics
- Multithreaded Summation: Using std::lock_guard
- Multithreaded Summation: Using Atomic Variable
- Multithreaded Summation: Using fetch_add Method
- Multithreaded Summation: Using fetch_add Method with Relaxed Semantic
- Thread Local Summation: Using Local Variable
- Thread Local Summation: Using an Atomic Variable with Sequential Consistency
- Thread Local Summation: Using an Atomic Variable with Relaxed Semantic
- Thread Local Summation: Using Thread Local Data
- Thread Local Summation: Using Tasks
- Calculate Sum of a Vector: Conclusion
-
Case Study: Thread-Safe Initialization of a Singleton
- Introduction
- Double Checked Locking PatternPreview
- Performance Measurement
- Classical Meyers Singleton
- Introduction to Thread Safe Meyers Singleton
- Thread Safe Singleton: std::lock_guard
- Thread Safe Singleton: std::call_once with std::once_flag
- Thread Safe Singleton: Atomics
- Conclusion
-
Case Study: Ongoing Optimization with CppMem
- Introduction to CppMem
- CppMem: An Overview
- CppMem: Non-Atomic Variables
- CppMem: Locks
- CppMem: Atomics with Sequential Consistency
- CppMem: Atomics with Acquire Release Semantic
- CppMem: Atomics with Non-Atomics
- CppMem: Atomics with Relaxed Semantic
- Conclusion
-
Parallel Algorithms of the Standard Template Library
- Execution Policies
- Parallel & Vectorized Execution
- Algorithms
- The New Algorithms
- New Algorithms - A Functional Perspective
-
The Future: C++20
- Atomic Smart Pointers
- Thread-Safe Linked List Using Atomic Pointers
- Introduction to Extended Futures
- Attaching Extended Futures
- Creating New Futures
- Latches and Barriers
- Transactional Memory - An Overview
- The Two Flavors of Transactional Memory
- Introduction to Coroutines
- Coroutines: More Details
- Task Blocks
-
Coding Examples
- ABA
- Blocking Issues
- Breaking of Program Invariants
- Data Races
- False Sharing
- Lifetime Issues of Variables
- Moving Threads
- Deadlocks
- Race Conditions
-
Best Practices
- General
- Memory Model
- Multithreading: Threads
- Multithreading: Shared Data
- Multithreading: Condition Variables
-
The Time Library
- The Interplay of Time Point, Time Duration, and Clock
- Time Point
- From Time Point to Calendar Time
- Time Duration
- Time Duration Calculations
- Clocks
- Sleep and Wait
-
Glossary
- Glossary
- Running Source Code on your own machine
-
About the Author
- Personal Notes
Modernes C++,
Thanks a lot to my Patreon Supporters: Eric Pederson, Paul Baxter, Meeting C++, Matt Braun, Avi Lachmish, Roman Postanciuc, and Venkata Ramesh Gudpati.
Weiterlesen...