
5.12. LOCKFREE SYNCHRONIZATION 155
• Due to work stealing (Section 5.3.2), and possibly better cache be-
havior, TBB code in some cases yields better performance.
• TBB does not require special compiler capability, in contrast say to
OpenMP, which requires that the compiler understand OpenMP prag-
mas.
• TBB provides greater flexibility than OpenMP, though at the expense
of considerably greater complexity.
Concerning this last bullet item, TBB requires one to make use of C++
functors, which are function objects taking the form of a struct or class.
We will use these in the Thrust context in Chapter 7, but functors are just
the beginning of the added complexity ...