Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

task_scheduler_init

eyalk
Beginner
265 Views
Hi:

We use windows threads in addition to TBB in a way that some of our windows threads declare task_scheduler_init object and use parallel_for. Does it mean that we have some task_scheduler_init objects running at the same time, each one of them may have different num_of_threads parameter or are they all using the same scheduler with the same num_of_threads parameter?

Thanks
0 Kudos
3 Replies
RafSchietekat
Black Belt
265 Views

"are they all using the same scheduler with the same num_of_threads parameter"
Yes.

eyalk
Beginner
265 Views
Quoting - Raf Schietekat

"are they all using the same scheduler with the same num_of_threads parameter"
Yes.


despite we have deffined 2 separate schedualers?
Anton_Pegushin
New Contributor II
265 Views
Quoting - eyalk

despite we have deffined 2 separate schedualers?
Yes.

Each master thread (a thread that starts a TBB parallel algorithm or uses tasks directly) has to have a task_scheduler_init object created in it. But task_scheduler_init objects are simply proxies to one TBB worker thread pool object (which is a singleton in the process address space) and the number of threads in the pool remain the same until the pool is destroyed. And calling parallel algorithms from either one of the master threads submits tasks to the same set of worker threads.
Reply