Intel Threading BuildingBlocks(Intel TBB)是一个使用ISO C++代码实现的多平台、可扩展并行编程库。下边首先给出一个免费版本的TBB下载链接:打开链接
(1)what's Intel Threading BuildingBlocks(Intel TBB)?
The Intel® Threading Building Blocks (Intel® TBB) library provides software developers with a solution for enabling parallelism in C++ applications and libraries. The well-known advantage of the Intel TBB library is that it makes parallel performance and scalability easily accessible to software developers writing loop- and task-based applications. The library includes a number of generic parallel algorithms, concurrent containers, support for dependency and data flow graphs, thread local storage, a work-stealing task scheduler for task based programming, synchronization primitives, a scalable memory allocator and more.
(2)TBB的结构:
上图的内容可以分为以下几类:
- 通用并行算法 TBB提供了parallel_for,parallel_while,parallel_reduce等算法,应用于不同的并行算法场景
- 并发容器 这是对常见容器的线程安全版本的实现,同时考虑到性能要求,提供了细粒度的锁机制,TBB2.0里提供的容器包括hash map,vector,queue。
- 任务调度器:提供了task机制的封装
- 同步原语:提供了原子操作、mutex、lock等同步原语的封装
- 内存分配:提供了对cache机制更友好的支持
更多详细资料参见:TBB 学习链接