Range partitioning
This type of partitioning is primarily used with collections where the length is known in advance. As the name suggests, every thread gets a range of elements to process or the start and end index of a source collection. This is the simplest form of partitioning and very efficient in the sense that every thread executes its range without overwriting other threads. There is no synchronization overhead, though some bits of performance are lost initially while creating ranges. This type of partitioning works best in scenarios where the number of elements in each range is the same so that they will take a similar length of time to finish. With a different number of elements, some tasks may finish early and sit idle, whereas ...
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