Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Concurrency with Modern C++

You're reading from   Concurrency with Modern C++ What every professional C++ programmer should know about concurrency.

Arrow left icon
Product type Paperback
Published in Dec 2019
Publisher
ISBN-13 9781839211027
Length 543 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rainer Grimm Rainer Grimm
Author Profile Icon Rainer Grimm
Rainer Grimm
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

1. Reader Testimonials FREE CHAPTER
2. Introduction 3. Concurrency with Modern C++ 4. Memory Model 5. Multithreading 6. Parallel Algorithms of the Standard Template Library 7. The Near Future: C++20 8. Case Studies 9. The Future: C++23 10. Patterns and Best Practices 11. Synchronisation Patterns 12. Concurrent Architecture 13. Best Practices 14. Lock-Based Data Structures 15. Challenges 16. The Time Library 17. CppMem - An Overview 18. Glossary 19. Index

Task Blocks

Task blocks use the well-known fork-join paradigm for the parallel execution of tasks. They are already part for the Technical Specification for C++ Extension Parallelism Version 2; therefore, it’s quite probable that we get them with C++20.

Who invented it in C++? Both Microsoft with its Parallel Patterns Library (PPL) and Intel with its Threading Building Blocks (TBB) were involved in the proposal N4441. Additionally, Intel used its experience with their Cilk Plus library.

The name fork-join is quite easy to explain.

Fork and Join

The most straightforward approach to explain the fork-join paradigm is a graphic.

The fork-join paradigm
The fork-join paradigm

How does it work?

The creator invokes define_task_block or define_task_block_restore_thread. This call creates a task block that can create tasks or it can wait for their completion. The synchronisation is at the end of the task block. The creation of a new task is the fork phase; the synchronisation of the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime