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

Concurrent nested work threads

jogshy
New Contributor I
237 Views
Can you tell me how to perform concurrent multiple work threads, pls?

For instance, imagine I want to perform a job with two threads in parallel. Then, I want 8 threads to spawn for each one of those two threads:


- Worker thread #1
- Child thread 1
- Child thread 2
- Child thread 3
- Child thread 4
- Child thread 5
- Child thread 6
- Child thread 7
- Child thread 8

- Worker thread #2
- Child thread 1
- Child thread 2
- Child thread 3
- Child thread 4
- Child thread 5
- Child thread 6
- Child thread 7
- Child thread 8

AFAIK, there is only one thread scheduler in TBB, so how can I perform this, pls?
Thanks.
0 Kudos
1 Reply
smasherprog
Beginner
237 Views
with tbb, you dont spawn threads, you spawn tasks. These tasks are then typically divided up between the exisitng hardware threads to be processed. In this way, you do not code for a 4 core platform with tbb, you code for a multi core platform, regardless of whether there are 64 physical cores or 2 --the code is the same.

So, what is it that you want to do with this program? If you intentions were to create as many threads as you have in cores, then somehow assign those threads work to do, then that isnt really what tbb is designed for.

I suggest going over the getting started, tutorial and the reference manual to see how tbb works.

http://www.threadingbuildingblocks.org/documentation.php
0 Kudos
Reply