Thread Pool in TBB

Thread Pool in TBB


I wanted to know whether TBB uses thread pool. In one of my applications I am
calling parallel_for for large number of times so I wanted to know if threads are
created during initialization or when parallel_for is called ?

Chaman Singh Verma
Poona, India

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Yes, Intel TBB does use a thread pool. The default number of threads added for that pool is one less than the number of Processing Elements available on the system so that with the creating thread, the pool comprises one thread per PE. This pool size can be overridden when a TBB program creates its task_scheduler_init object. Threads in this pool persist until the task_scheduler_init object is destroyed. To avoid thread pool thrashing (creation, destruction and recreation of the pool), you should create the task_scheduler_init object at a place in your code where its lifetime will span any TBB parallel constructs that may be invoked during execution.

Leave a Comment

Please sign in to add a comment. Not a member? Join today