Intel Parallel Studio

Lock Pathologies

Locks can introduce performance and correctness problems. If you are new to locking, here are some of the problems to avoid:


Deadlock happens when threads are trying to acquire more than one lock, and each holds some of the locks the other threads need to proceed. More precisely, deadlock happens when:

  • There is a cycle of threads

Recursive Chain Reaction

The scheduler works best with tree-structured task graphs, because that is where the strategy of "breadth-first theft and depth-first work" applies very well. Also, tree-structured task graphs allow fast creation of many tasks. For example, if a master task tries to create N children directly, it will take O(N) steps. But with tree structured forking, it takes only O(lg(N)) steps.

Version Information

Intel® Threading Building Blocks (Intel® TBB) has macros, an environment variable, and a function that reveal version and run-time information.

Version Macros

The header tbb/tbb_stddef.h defines macros related to versioning, as described below. You should not redefine these macros.


The container classes permit multiple threads to simultaneously invoke certain methods on the same container.

Like STL, Intel® Threading Building Blocks (Intel® TBB) containers are templated with respect to an allocator argument. Each container uses its allocator to allocate memory for user-visible items. A container may use a different allocator for strictly internal structures.

订阅 Intel Parallel Studio