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

task_scheduler_init

eyalk
Beginner
456 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
Valued Contributor III
456 Views

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

0 Kudos
eyalk
Beginner
456 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?
0 Kudos
Anton_Pegushin
New Contributor II
456 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.
0 Kudos
Reply