Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2455 Discussions

what's the different between boost.threadpool and tbb?


I am a begineer with tbb.As far I know,tbb looks like a threadpool which  could handle tasks.And boost.threadpool can do the same thing.

So,what's the different between boost.threadpool and tbb?

0 Kudos
1 Reply
Valued Contributor II

The Boost threadpool library offers a rudimentary thread pool with fairly low-level support for threads and tasks:

boost::threadpool::future< Result >Experimental. Do not use in production code. TODO

boost::threadpool::empty_controller< Pool >SizePolicyController which provides no functionality

boost::threadpool::fifo_scheduler< Task >SchedulingPolicy which implements FIFO ordering

boost::threadpool::immediately< Pool >ShutdownPolicy which does not wait for any tasks or worker termination

boost::threadpool::lifo_scheduler< Task >SchedulingPolicy which implements LIFO ordering

boost::threadpool::looped_task_funcLooped task function object

boost::threadpool::prio_scheduler< Task >SchedulingPolicy which implements prioritized ordering

boost::threadpool::prio_task_funcPrioritized task function object

boost::threadpool::resize_controller< Pool >SizePolicyController which allows resizing

boost::threadpool::static_size< Pool >SizePolicy which preserves the thread count

boost::threadpool::thread_pool< Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy >Thread pool

boost::threadpool::wait_for_active_tasks< Pool >ShutdownPolicy which waits for the completion of all active tasks and the worker termination afterwards

boost::threadpool::wait_for_all_tasks< Pool >ShutdownPolicy which waits for the completion of all tasks and the worker termination afterwards

Intel Threading Building Blocks offers a thread pool but supports it with a lot more scheduling and policy and generic algorithms and thread-safe container support, including parallel_for, parallel_reduce,  pipelines,  flow::graph and more, plus a multi-thread aware memory allocator that improves allocation overhead and more.  I would encourage you as a beginning TBB user to read the available documentation (here would be a good place to start: ) and learn for yourself how much more Intel TBB has to offer.

0 Kudos