Threading Building Blocks (TBB) is a C++templatelibrary developed by Intel for writing software programs that take advantage of multi-core processors. The library consists of data structures and algorithms that allow a programmer to avoid some complications arising from the use of native threading packages such as POSIX threads, Windows threads, or the portable Boost Threads in which individual threads of execution are created, synchronized, and terminated manually. Instead the library abstracts access to the multiple processors by allowing the operations to be treated as "tasks", which are allocated to individual cores dynamically by the library's run-time engine, and by automating efficient use of the CPU cache. A TBB program creates, synchronizes and destroys graphs of dependent tasks according to algorithms, i.e. high-level parallel programming paradigms (a.k.a. Algorithmic Skeletons). Tasks are then executed respecting graph dependencies. This approach groups TBB in a family of solutions for parallel programming aiming to decouple the programming from the particulars of the underlying machine.

Contents

TBB implements work stealing to balance a parallel workload across available processing cores in order to increase core utilization and therefore scaling. The TBB work stealing model is similar to the work stealing model applied in Cilk. Initially, the workload is evenly divided among the available processor cores. If one core completes its work while other cores still have a significant amount of work in their queue, TBB reassigns some of the work from one of the busy cores to the idle core. This dynamic capability decouples the programmer from the machine, allowing applications written using the library to scale to utilize the available processing cores with no changes to the source code or the executable program file.

TBB, like the STL (and the part of the C++ standard library based on it), uses templates extensively. This has the advantage of low-overhead polymorphism, since templates are a compile-time construct which modern C++ compilers can largely optimize away.

Intel TBB is available commercially as a binary distribution with support,[3] and as open-source software in both source and binary forms.[4]

Version 1.0 was introduced by Intel on August 29, 2006, the year after the introduction of Intel's first dual-core x86 processor, the Pentium D.

Version 1.1 was introduced on April 10, 2007. This version introduced auto_partitioner which offered an automatic alternative to specifying a grain size parameter to estimate the best granularity for particular tasks. This version was added to the Intel C++ Compiler 10.0 with the new Professional Edition later that year on June 5.

Version 2.0 was introduced on July 24, 2007. This version included the release of the source code and the creation of an open source project.[4] The license used for open source is the same as the one previously used by the GNU Compiler CollectionC++ standard library, a GPLv2 with a "runtime exception" (because of being template heavy code that usually becomes part of the executable after compilation). TBB is still available in a commercial version (without source code) with support but with no differences in functionality from the open source version.

Version 2.1 was introduced on July 22, 2008. Version 2.1 features included task-to-thread affinity, cancellation support, exception handling, and a portable thread wrapper.[5] Version 2.2 features support for lambda functions in C++0x.

Version 4.2 was introduced on September 4, 2013. It introduces support for the new speculative locking synchronization primitive speculative_spin_mutex which takes advantage of with Intel Transactional Synchronization Extensions (Intel TSX) feature in 4th generation Intel Core processors. It now also supports C++11 exact exception propagation as well as adding support for more concurrent container types (concurrent_unordered_multiset and concurrent_unordered_multimap).[6]

Version 4.3 was introduced on August 26, 2014. It introduces support tasks arenas. It also improves C++11 support.[7]