Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jogshy
New Contributor I
35 Views

Concurrent nested work threads

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
35 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