Threading Building Blocks

From Wikipedia, the free encyclopedia
  (Redirected from Intel Threading Building Blocks)
Jump to: navigation, search
Threading Building Blocks
Developer(s) Intel
Stable release 4.2 Update 5 / June 1, 2014; 2 months ago (2014-06-01)[1][2]
Written in C++
Operating system FreeBSD, Linux, Solaris, OS X, Windows
Type library or framework
License dual: commercial / open source (GPLv2 with the (libstdc++) runtime exception)
Website www.threadingbuildingblocks.org
software.intel.com/en-us/intel-tbb

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.

Implementation[edit]

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.

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

Library contents[edit]

TBB is a collection of components for parallel programming:

  • Basic algorithms: parallel_for, parallel_reduce, parallel_scan
  • Advanced algorithms: parallel_while, parallel_do, parallel_pipeline, parallel_sort
  • Containers: concurrent_queue, concurrent_priority_queue, concurrent_vector, concurrent_hash_map
  • Scalable memory allocation: scalable_malloc, scalable_free, scalable_realloc, scalable_calloc, scalable_allocator, cache_aligned_allocator
  • Mutual exclusion: mutex, spin_mutex, queuing_mutex, spin_rw_mutex, queuing_rw_mutex, recursive_mutex
  • Atomic operations: fetch_and_add, fetch_and_increment, fetch_and_decrement, compare_and_swap, fetch_and_store
  • Timing: portable fine grained global time stamp
  • Task Scheduler: direct access to control the creation and activation of tasks

History[edit]

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 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.[5] 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).[6]

Systems supported[edit]

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).[7] Additionally, the TBB open source community has contributed patches for Solaris,[8] PowerPC, Xbox 360, QNX Neutrino, and FreeBSD.

Open source operating systems[edit]

As of March 2010, TBB has been packaged into the following operating system distributions:

See also[edit]

Notes[edit]

References[edit]

External links[edit]