I Proudly present my Book is Ready “Concurrency with Modern C++”
Concurrency with Modern C++ is a 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: Leanpub.com: Concurrency with Modern C++
What’s Inside?
This book 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 book 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
- Conventions
- Source Code
- Run the Programs
- How you should read the book?
- Personal Notes
- Acknowledgements
- About Me
- My Special Circumstances
- A Quick Overview
- Concurrency with Modern C++
- C++11 and C++14: The foundation
- Memory Model
- Multithreading
- Case Studies
- Calculating the Sum of a Vector
- Thread-Safe Initialisation of a Singleton
- Ongoing Optimisation with CppMem
- C++17: Parallel Algorithms of the Standard Template Library
- Execution Policy
- New Algorithms
- C++20: The Concurrent Future
- Atomic Smart Pointers
- Extended futures
- Latches and Barriers
- Coroutines
- Transactional Memory
- Task Blocks
- Challenges
- Best Practices
- Time Library
- Glossary
- C++11 and C++14: The foundation
- Concurrency with Modern C++
- The Details
- Memory Model
- The Contract
- The Foundation
- The Challenges
- Atomics
- Strong versus Weak Memory Model
- The Atomic Flag
- The Class Template
std::atomic
- User Defined Atomics
- All Atomic Operations
- Free Atomic Functions
std::shared_ptr
- The Synchronisation and Ordering Constraints
- The six variants of the C++ memory model
- Sequential Consistency
- Acquire-Release Semantic
- std::memory_order_consume
- Relaxed Semantic
- Fences
- Fences as Memory Barriers
- The three Fences
- Acquire-Release Fences
- Synchronisation with Atomic Variables or Fences
- The Contract
- Multithreading
- Threads
- Creation
- Lifetime
- Arguments
- Methods
- Shared Data
- Mutexes
- Locks
- Thread-safe Initialisation
- Thread-Local Data
- Condition Variables
- The Wait Workflow
- Lost Wakeup and Spurious Wakeup
- Tasks
- Threads versus Tasks
- std::async
- std::packaged_task
- std::promise and std::future
- Threads
- Case Studies
- Calculating the Sum of a Vector
- Single Threaded addition of a Vector
- Multithreaded Summation with a Shared Variable
- Thread-Local Summation
- Summation of a Vector: The Conclusion
- Thread-Safe Initialisation of a Singleton
- Double-Checked Locking Pattern
- My Strategy
- Thread-Safe Meyers Singleton
std::call_once
with thestd::once_flag
- Atomics
- Performance Numbers of the various Thread-Safe Singleton Implementations
- Ongoing Optimisation with 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
- Calculating the Sum of a Vector
- Parallel Algorithms of the Standard Template Library
- Execution Policies
- Algorithms
- The functional Heritage
- The Future: C++20
- Atomic Smart Pointers
- A thread-safe singly linked list
- Extended Futures
std::future
std::async
,std::packaged_task
, andstd::promise
- Creating new Futures
- Latches and Barriers
std::latch
std::barrier
std::flex_barrier
- Coroutines
- A Generator Function
- Details
- Transactional Memory
- ACI(D)
- Synchronized and Atomic Blocks
transaction_safe
versustransaction_unsafe
Code
- Task Blocks
- Fork and Join
define_task_block
versusdefine_task_block_restore_thread
- The Interface
- The Scheduler
- Atomic Smart Pointers
- Memory Model
- Further Information
- Challenges
- ABA
- Blocking Issues
- Breaking of Program Invariants
- Data Races
- False Sharing
- Lifetime Issues of Variables
- Moving Threads
- Deadlocks
- Race Conditions
- Best Practices
- General
- Code Reviews
- Minimise Data Sharing of mutable data
- Minimise Waiting
- Prefer Immutable Data
- Look for the Right Abstraction
- Use Static Code Analysis Tools
- Memory Model
- Don’t use volatile for synchronisation
- Don’t program Lock Free
- If you program Lock-Free, use well-established patterns
- Don’t build your own abstraction, use guarantees of the language
- Multithreading
- Threads
- Data Sharing
- Condition Variables
- Promises and Futures
- General
- The Time Library
- The Interplay of Time Point, Time Duration, and Clock
- Time Point
- From Time Point to Calendar Time
- Cross the valid Time Range
- Time Duration
- Calculations
- Clocks
- Accuracy and Steadiness
- Epoch
- Sleep and Wait
- Glossary
- ACID
- Callable Unit
- Concurrency
- Critical Section
- Function Objects
- Lambda Functions
- Lock-free
- Lost Wakeup
- Modification Order
- Monad
- Non-blocking
- Parallelism
- Predicate
- RAII
- Sequential Consistency
- Sequence Point
- Spurious Wakeup
- Thread
- Total order
- volatile
- wait-free
- Challenges
- Index
Modernes C++ Mentoring
Do you want to stay informed: Subscribe.
Modernes C++,
Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschläger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Stephen Kelley, Kyle Dean, Tusar Palauri, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, Rob North, Bhavith C Achar, Marco Parri Empoli, Philipp Lenk, Charles-Jianye Chen, Keith Jeffery, Matt Godbolt, and Honey Sukesan.
Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, Slavko Radman, and David Poole.
My special thanks to Embarcadero | |
My special thanks to PVS-Studio | |
My special thanks to Tipi.build | |
My special thanks to Take Up Code | |
My special thanks to SHAVEDYAKS |
Modernes C++ GmbH
Modernes C++ Mentoring (English)
Rainer Grimm
Yalovastraße 20
72108 Rottenburg
Mail: schulung@ModernesCpp.de
Mentoring: www.ModernesCpp.org
Modernes C++ Mentoring,
Leave a Reply
Want to join the discussion?Feel free to contribute!