25.5 Parallel Execution
All algorithms are executed sequentially unless you are programming in C++17 and use an execution policy from the <execution> header as an additional first parameter to an algorithm function template. Not all algorithms support all policies:
-
std::execution::seqThe algorithm is not parallelized and runs in the calling thread. However, unlike without this parameter, the steps can be executed in a different order.
-
std::execution::parThe steps can be executed in parallel. The work is divided among multiple threads, and each thread executes individual steps sequentially in an unspecified order.
-
std::execution::unseq_parThe steps can be executed in parallel and simultaneously. In addition to par, each thread can execute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access