Skip to Main Content
Intel Threading Building Blocks
book

Intel Threading Building Blocks

by James Reinders
July 2007
Intermediate to advanced content levelIntermediate to advanced
332 pages
10h 4m
English
O'Reilly Media, Inc.
Content preview from Intel Threading Building Blocks

Load Imbalance

The task scheduler does load balancing. With thread-based programming, you are often stuck dealing with load balancing yourself, which can be tricky to get right. By breaking your program into many small tasks, the Threading Building Blocks scheduler assigns tasks to threads in a way that spreads out the work evenly.

Threading Building Blocks emphasizes scalable, data-parallel programming. Breaking up a program into separate functional blocks and assigning a separate thread to each block often doesn’t scale well because the number of functional blocks is typically fixed. In contrast, the flexible data-parallel programming technique in Threading Building Blocks enables multiple threads to work on different parts of a collection. Data-parallel programming scales well to larger numbers of processors because it divides the collection (continually and recursively, if necessary) into smaller pieces. This scalability protects you from having to rewrite an application every time a new chip with more processor cores ships.

In addition to using the right number of threads, it is important to distribute work evenly across those threads. As long as you break your program into enough small tasks, the scheduler usually does a good job of assigning tasks to threads in order to balance the load on different processors.

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.
Start your free trial

You might also like

Intel® Xeon Phi™ Coprocessor Architecture and Tools: The Guide for Application Developers

Intel® Xeon Phi™ Coprocessor Architecture and Tools: The Guide for Application Developers

Rezaur Rahman

Publisher Resources

ISBN: 9780596514808Errata Page