Intel® Threading Building Blocks

Spin wait implementation in TBB

In src\tbb\TBB_misc.h there is a spin wait which embeds a looped PAUSE instruction in a while wait, something like this:

while (!condition)


if( count<=LOOPS_BEFORE_YIELD ) {

//[hanm] this is actually a looped PAUSE
} else {


My question is, why doing this looped PAUSE, instead of issuing *a single* PAUSE instruction in the spin wait? Someting looks like:

int count = 0;

while (!condition)


PAUSE; //emit asm here

count ++;

error when compiling sample code with g++

I am beginning to work with the Threading Building Blocks and I'm having an issue compiling the sample program (sub_string_finder.cpp) with g++. However, when I use intel's c++ compiler, it compiles just fine.

To compile with g++, I execute:

g++ sub_string_finder.cpp -ltbb

and I get an error:
sub_string_finder.cpp:60: error: first argument of int main(size_t, char**) should be int

However, when I execute: icpc sub_string_finder.cpp -ltbb

parallel_Reduces memory access problem

hi all,

I am trying to figure out for last 2 days why this code is not working. The code is giving me memory access error.

The code is as follows:-

#include "tbb/task_scheduler_init.h"
#include "tbb/parallel_reduce.h"
#include "tbb/blocked_range.h"

using namespace tbb;
using namespace std;

class Parallel_StringFinder{

vector edgeList;
vector nodeList;
set::iterator it;
bool flag1,flag2,toInsert;


Information on TBB Scheduler and Task Stealing

Hi all,

I am trying to get some information on the details of the TBB scheduler code in task.cpp. I basically want to profile how well the random task scheduler performs by tracking each instance of a false negative -- that is, one thread tries to steal a task from another randomly selected task queue, and fails to do so despite the fact that other task queues in fact do have tasks available.

msvs_plugin_20080610 under Vista64


I have a starting problem with TBB and msvs_plugin under Vista64. After doing the following steps, the registration is not succeeded in VS2005 and VS2008.

Ididdownload and additional

1. I unzipped to C:\I\INTEL\tbb21_012oss the directory where TBB should reside for me.

2. I set the environvariable TBB21_INSTALL_DIR C:\I\INTEL\tbb21_012oss

Stack Overflow

I'm porting an app to TBB. Before I started, everything worked well, but now I'm having problems with stack overflow. How do I go about tracking this down? (The call stack window in VS2008 shows a list of calls, but warns me that "Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll".)

concurrent_queue freezes after 65535 pops

I have a bizarre problem with TBB concurrent queues and would appreciate any help.

I have two tasks running in parallel (triggered in a parallel_for). The first task ("producer") pushes an event pointer to an eventQueue and waits for (pops) an acknowledgement on an ackQueue. The second task ("consumer") pops the eventQueue and pushes an acknowledgement to the ackQueue once it is done. This way I can have multiple consumers subscribing to the same set of events.

scalable_malloc and cache alignment

Hey all,

I'm writing some low-level code (for cache optimized data structures), and it's critical that I know that the pointer returned by scalable_malloc points to the beginning of a cache-line. Is this the default behaviour of scalable_malloc? Is it even possible to ensure that I've actually allocated memory at the beginning of a cache-line?



S’abonner à Intel® Threading Building Blocks