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.