Search⌘ K
AI Features

Par/Seq Policy Usage

Explore how to use the parallel and sequential execution policies in C++17 to control the behavior of STL algorithms. Understand when to use each policy for debugging or performance and learn the limitations to avoid data races and deadlocks. Gain insight into synchronization needs and efficient parallel execution practices for safer multithreaded programming.

Why do you need the sequential policy?

Most of the time you’ll be probably interested in using parallel policy or parallel unsequenced one. But for debugging it might be easier to use std::execution::seq. The parameter is also quite convenient as you might easily switch between the execution model using a template parameter. For some algorithms, the sequential policy might also give better performance than the C++14 counterpart.

Read more in the ...