Task Blocks
Explore task blocks in C++20 concurrency to understand the fork-join paradigm for parallel task execution. Learn how to create and synchronize tasks using define_task_block and its variations, along with scheduling strategies like child and parent stealing.
We'll cover the following...
Task blocks use the well-known fork-join paradigm for the parallel execution of tasks.
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 its Cilk Plus library.
The name fork-join is quite easy to explain.
Fork & Join
The simplest approach to explain the fork-join paradigm is through a graph.
How does it work?
The creator invokes define_task_block or define_task_block_restore_thread. This call creates a task block that can ...