Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2465 Discussions

What's the varible "steal_begin" and "steal_end" used for?

christiecohen
Beginner
347 Views
I read the code of task scheduler, found that the "steal_begin" and "steal_end" is widely used?

I'm wondering whatare theyused for?
I guess maybe to restrict the work stealing.

But I don't really know how.

Why initialize the steal_end to -3 and -4?

Another question is, what set the slot number to twice of the worker number?


Thanks.
Looking forward your reply.
0 Kudos
6 Replies
christiecohen
Beginner
347 Views
Quoting - christiecohen
I read the code of task scheduler, found that the "steal_begin" and "steal_end" is widely used?

I'm wondering whatare theyused for?
I guess maybe to restrict the work stealing.

But I don't really know how.

Why initialize the steal_end to -3 and -4?

Another question is, what set the slot number to twice of the worker number?


Thanks.
Looking forward your reply.

Has any Intel guy seen my problem?

Please give me some tips.
0 Kudos
Alexey-Kukanov
Employee
347 Views
These variables were used in the implementation of the task pool used up to TBB 2.1. Their main purpose was to restrict task stealing, as you correctly guessed. steal_end was also used to lock the task pool during spawning, taking out, or stealing a task.

For the next version of TBB, the task pool implementation and some related classes were redesigned to use more modern, scalable, and lower overhead algorithm. These two variables have gone in the new implementation, which is available in OSS development releases.
0 Kudos
christiecohen
Beginner
347 Views
These variables were used in the implementation of the task pool used up to TBB 2.1. Their main purpose was to restrict task stealing, as you correctly guessed. steal_end was also used to lock the task pool during spawning, taking out, or stealing a task.

For the next version of TBB, the task pool implementation and some related classes were redesigned to use more modern, scalable, and lower overhead algorithm. These two variables have gone in the new implementation, which is available in OSS development releases.

And why the slot number was initialized to twice the number of workerThread?
0 Kudos
christiecohen
Beginner
347 Views
Quoting - christiecohen

And why the slot number was initialized to twice the number of workerThread?

Besides, is the newer version of source code provided?

I only found the tbb20_014oss_src
0 Kudos
robert_jay_gould
Beginner
347 Views
Quoting - christiecohen

Besides, is the newer version of source code provided?

I only found the tbb20_014oss_src

You need to check the Development Release downloads. Here is a link (that works circa 2008/05).



0 Kudos
Alexey-Kukanov
Employee
347 Views
Quoting - christiecohen
And why the slot number was initialized to twice the number of workerThread?

It's to allow several master threads, in case a user wants to run TBB from different threads in his application.
0 Kudos
Reply