Information on TBB Scheduler and Task Stealing

Dmitriy Vyukov
Total Points:
24,747
Status Points:
24,747
Black Belt
November 9, 2008 3:31 AM PST
Rate
 
#4
Quoting - abhishek84

task* GenericScheduler::steal_task( UnpaddedArenaSlot& arena_slot, depth_type d ) {

...

TaskPool* tp = arena_slot.task_pool;
depth_type i = tp->prefix().steal_begin;
if( i<d )
i = d;
for(; i<=steal_end>>1; ++i ) {

if( result = tp->array[i] ) {

tp->array[i] = result->prefix().next;

#ifdef(MY_COUNTER)
counter--
#endif

...

}

It seems that you are working with not latest release. However be aware that in latest releases there is another issue - mailboxes. Single task can reside in thread's work-stealing deque AND in another thread's mailbox SIMULTANEOUSLY.

get_task() function copes with it internally. But steal_task() doesn't. I.e. steal_task() can return such task, and then the task will be discarded, because it's already consumed through get_task().

If you will be working with latest version you must account for this.

 



Intel Software Network Forums Statistics

8290 users have contributed to 31236 threads and 99111 posts to date.
In the past 24 hours, we have 7 new thread(s) 20 new posts(s), and 30 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x