Intel® Threading Building Blocks

TBB Source Code: Tasks Queues and Stealing


I'm looking at the TBB source in detail, in particular the scheduler.

What I would like to be able to do is write my own task stealing algorithm, in particular I want to be able to steal tasks from all CPUs at once (that have certain properties) and actually take them away from TBB altogether (migrate to another system).

Any pointers on where in the code I should be looking to interface? Right now I'm tracing through task.cpp, but I don't understand what is meant by "Gate" and "Arena". What are the actual task lists processed by CPUs?



TBB Exception Safety

Hey, I have an interesting problem with trying to make tbb exception safe. My code sets up an execution tree similar to 'Two Mouths' example in the TBB book. Here is the psuedocode:

tbb::task_group_context context(tbb::task_group_context::isolated);
tbb::task*root = new (tbb::task::allocate_root(context))tbb::empty_task;

Allocate all tasks as child of the root

root->set_ref_count(number of children + 1);


Leaking memory with scalable_malloc/free when closing threads

We've had an issue leaking memory when using scalable_malloc/free on Windows. The fix was to manually call mallocThreadShutdownNotification when the thread was exiting. I never saw any documentation nor was this in Reinders' book. I ended up reading the code in MemoryAllocator.cpp and saw that this was being registered in the pthreads implementation but not the winthreads implementation. To use it I had to include src bbmallocTypeDefinitions.h out of the source code and not the include directories.

Introducing a grain parameter for parallel_while?

Hi guys!

I find tbb::parallel_while very useful for my applications. However some experiments showed poor scalability due to a small iteration task weight as comapared with parallel_while and task stealing overheads. The scalability was improved after I enlarged the grain by grouping several iteration items into one item.

TBB example code projects need to be updated

This may or may not be an Intel problem.

In the newest version of the Intel Compiler Suite Professional Edition for Windows

TBB 2.0 is shipped. However the macros inside of the project file TBB examples are all referencing TBB11_INSTALL_DIR not TBB20_INSTALL_DIR . This probably should be changed to TBB_INSTALL_DIR and in the environment variables set


Or whatever the most recent installed copy is. The user can reset this to retrograde the version.

Jim Dempsey

Concurrent stack?

Hello everybody,

I was wondering if there is any plan to add a concurrent stack to tbb? Indeed, a concurrent_queue is almost always the right way to pass some data from one thread to another one, but sometimes we would like to fetch the most recently added data.


Extending TBB to Clusters: My Summer Research Project

I've been busy constructing my cluster library, which currently involves wrapping C code for RDMA (librdmacm) with C++ constructs to give exception safety, and make my life easier in general by giving the library a C++ feel. Rather than giving a nice design document with diagrams, I thought I'd give a verbal outline of what I'm doing via this post.

Expression: my_owner

I get this strage error when I try to execute a parallel_for from a worker thread. And yes I didcall task_scheduler_init, but from the main thread.

The error is an assertion:

Expression: my_owner

Thread has not activated a task_scheduler_init object?

the assertion is thrown at

task_group_context ( kind_type relation_with_parent = bound )

: my_kind(relation_with_parent)

, my_version(0)




Migration from pthread to TBB

I have developed network based application by using the pthread library. Now, to best utilize the Multi-core platform, I want to give a trial to TBB library. I have just started to get in depth of TBB. In my application there is combination of functional and data decomposition. I am unable to get(understand) the TBB API, which can be used to model the functional decomposition.
Let say, application has three independent functional unit :

  1. FUN1()
  2. FUN2()
  3. and FUN3()
Subscribe to Intel® Threading Building Blocks