Threading Building Blocks, PThreads, and Gentoo Linux

Tonight I spoke with a new (to me) person who has integrated Threading Building Blocks into an interesting application. This developer originally worked using pthreads, then decided about a month ago to switch to Threading Building Blocks (after his pthreads application only marginally improved performance). He reported (on the #tbb IRC channel) that after a month of development his TBB-threaded application produces a 2-times speed up, versus a fractional speed up after 5 months of development using pthreads.

The development effort factor

This, to me, is a significant "real life" demonstration of the benefits TBB provides. Traditional threading, in this particular instance, provided a processing efficiency gain that was much smaller than the gain accrued when TBB was implemented. And it was possible to replace the original PThreads implementation with a Threading Building Blocks implementation in just a month! Those who know about multithreaded development can appreciate that multithreading a significant project in one month is quite an accomplishment.

The Gentoo factor

So how, you ask, does Gentoo Linux fit into this post? Well, the developer I'm talking about has provided me with a Gentoo "ebuild" for installing Threading Building Blocks on your Gentoo Linux system. I have not yet unpacked the ebuild -- I'll get to that soon! But I think this is a great indication that TBB is finding its community, a community that wants to help make Threading Building Blocks more conveniently available to other developers who are working on their own favored platform.

Gentoo Linux has a reputation as being a "developer's Linux distribution." I think this is true. Gentoo in fact calls itself a "meta-distribution" rather than a full Linux distribution -- by which they mean, they provide the pieces and you construct the operating system / environment you want. So, if we can get this Gentoo ebuild configured properly, then it could be integrated such that you'd be able to use Gentoo's Portage package installer to install a working TBB library onto your Gentoo system, providing you with a working TBB environment on Gentoo,

TBB installation packaging

Threading Building Blocks is finding developers who want to use the library on a wide variety of operating systems. Intel's Mike Davis documented the early support for TBB by []Linux distributors in the TBB Forum. Tonight I received a Gentoo Linux TBB ebuild from a developer who has successfully implemented Threading Building Blocks in a significant application. I'll be working with this ebuild and will report on it in future posts.

Kevin Farnham
O'Reilly Media
TBB Open Source Community

For more complete information about compiler optimizations, see our Optimization Notice.


Kevin Farnham's picture

Chris and Dmitry -- the ebuild is being tested. Changes on the site required changes to the ebuild. If yiou'd like, you can come onto the #tbb IRC channel on The ebuild developer is there frequently. As soon as the ebuild is fixed, the intent is to make it available publicly.

The ebuild has not yet been submitted to Gentoo, but doing that is planned.

anonymous's picture

Hello! Please tell, when ebuild for gentoo will availble to download?

anonymous's picture

Is this ebuild available for download? It doesn't appear to be part of Gentoo or submitted to yet.

anonymous's picture

I don't know details of the application the developer told me about. One possibility for why TBB would produce much improved performance compared with pthreads would be a situation where some threads completed a long time prior to others. In this case, the pthread application might leave some processor cores idle, while TBB's scheduler would apply task-stealing to provide new work to the cores that had become idle.

anonymous's picture

Hi Kevin,

Some questions/thoughts about the problem of converting old pthreaded applications into an TBB-threaded applications. Assume that the hard work of profiling and finding the heavy sections of the applications and converting those into thread safe pthearded sections. I do not see why it would be very time consuming converting those section into TBB-thread sections instead of pthreaded sections. If you want to increase the parallel sections (Amdahl's law) with some new TBB stuff I can understand the extra time needed.

Do you know how the speedup was achieved, was it do to Amdahl's law or was it due to less overhead in the TBB implementation compared to the pthread implementation? If it was due to Amdahl's law do you know what functions in TBB he used (normal parallel for or some pipelining)?


Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.