Threading Building Blocks
|Stable release||4.2 Update 5 / June 1, 2014|
|Operating system||FreeBSD, Linux, Solaris, OS X, Windows|
|Type||library or framework|
|License||dual: commercial / open source (GPLv2 with the (libstdc++) runtime exception)|
Threading Building Blocks (TBB) is a C++ template library 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.
TBB implements task stealing to balance a parallel workload across available processing cores in order to increase core utilization and therefore scaling. The TBB task 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.
TBB is a collection of components for parallel programming:
- Basic algorithms:
- Advanced algorithms:
- Scalable memory allocation:
- Mutual exclusion:
- Atomic operations:
- Timing: portable fine grained global time stamp
- Task Scheduler: direct access to control the creation and activation of tasks
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. The license used for open source is the same as the one previously used by the GNU Compiler Collection C++ 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. Version 2.2 features support for lambda functions in C++0x.
Version 3.0 was introduced on May 4, 2010. It has a number of improvements, see (http://software.intel.com/en-us/blogs/2010/05/04/tbb-30-new-today-version-of-intel-threading-building-blocks/)
Version 4.0 was introduced on September 8, 2011. It has several new features, see (http://threadingbuildingblocks.org/whatsnew.php)
Version 4.1 was introduced on September 5, 2012. It has improvements in TBB memory allocator, full support of parallel_deterministic_reduce template function and other updates, see (http://threadingbuildingblocks.org/uploads/77/188/4.1/CHANGES.txt)
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).
The TBB commercial release 3.0 supports Windows (XP or newer), OS X (version 10.5.8 or higher) and Linux using Visual C++ (version 8.0 or higher, on Windows only), Intel C++ Compiler (version 11.1 or higher) or the GNU Compiler Collection (gcc). Additionally, the TBB open source community has contributed patches for Solaris, PowerPC, Xbox 360, QNX Neutrino, and FreeBSD.
Open source operating systems
As of March 2010[update], TBB has been packaged into the following operating system distributions:
- Red Hat Fedora
- Canonical Ubuntu
- Arch Linux
- Red Flag Asianux
- Sun Solaris
- Sun OpenSolaris
- Cilk/Cilk Plus
- Intel Concurrent Collections (CnC)
- Intel Parallel Building Blocks (PBB)
- Intel Array Building Blocks (ArBB)
- Intel Parallel Studio
- Intel Developer Zone (Intel DZ; support and discussion)
- Algorithmic skeleton
- Parallel computing
- List of C++ multi-threading libraries
- List of C++ template libraries
- Parallel Patterns Library
- Grand Central Dispatch (GCD)
- "What's New? Intel® Threading Building Blocks 4.2 update 4".
- "Intel Threading Building Blocks Release Notes".
- http://www.threadingbuildingblocks.com Intel Threading Building Blocks Commercial Version Homepage
- http://www.threadingbuildingblocks.org Threading Building Blocks Open Source Project Homepage
- "What's New? Intel Threading Building Blocks 4.2".
- "Intel Threading Building Blocks - Release Notes Version 3.0". Retrieved 2011-08-08.
- "Using Intel's Threaded Building Blocks (TBB) With Sun Studio Express". Retrieved 2008-05-08.
- Reinders, James (July 2007), Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism (Paperback ed.), Sebastopol: O'Reilly Media, ISBN 978-0-596-51480-8
- Voss, M. (October 2006), Demystify Scalable Parallelism with Intel Threading Building Blocks' Generic Parallel Algorithms
- Voss, M. (December 2006), Enable Safe, Scalable Parallelism with Intel Threading Building Blocks' Concurrent Containers
- Hudson, Richard L.; Saha, Bratin; Adl-Tabatabai, Ali-Reza; Hertzberg, Benjamin C. (2006), "McRT-Malloc", Proceedings of the 2006 international symposium on Memory management - ISMM '06, pp. 74–83, doi:10.1145/1133956.1133967, ISBN 1595932216