- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a test program with root, child and continuation tasks. Using gdb, I put breakpoints at the execute functions of the root task and the continuation task. When reaching them, I used info threads to see how many threads were running:
So my question is if a root task or a continuation task could be executed by more than one thread.
Thanks.
PS: I have a 2 core machine.
I have a test program with root, child and continuation tasks. Using gdb, I put breakpoints at the execute functions of the root task and the continuation task. When reaching them, I used info threads to see how many threads were running:
[plain]2 Thread 0xb7ed1b70 (LWP 8537) 0x0012d422 in __kernel_vsyscall () * 1 Thread 0xb7fd27a0 (LWP 8534) MyRoot::execute (this=0xb7fb3aa0) at ../src/src/MyRoot.cpp:44 [/plain]The same output goes for the continuation task.
So my question is if a root task or a continuation task could be executed by more than one thread.
Thanks.
PS: I have a 2 core machine.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"So, if in execute() I don't create more child tasks or recycle the task, execute() will be run entirely in one thread, isn't it?"
If you don't create child tasks directly or indirectly, e.g., through parallel_for(), that execute() call will run entirely in one thread. If you recycle the task, execute() may run in a different thread, but not concurrently.
If you don't create child tasks directly or indirectly, e.g., through parallel_for(), that execute() call will run entirely in one thread. If you recycle the task, execute() may run in a different thread, but not concurrently.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"So my question is if a root task or a continuation task could be executed by more than one thread."
Not concurrently, but the program could have them recycled. What do you have in mind?
Not concurrently, but the program could have them recycled. What do you have in mind?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I thought that execute could be splitted in more than one thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As used by TBB, execute() may of course create child tasks, and those could well be executed by other threads.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok!
So, if in execute() I don't create more child tasks or recycle the task, execute() will be run entirely in one thread, isn't it?.
Thanks!
So, if in execute() I don't create more child tasks or recycle the task, execute() will be run entirely in one thread, isn't it?.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"So, if in execute() I don't create more child tasks or recycle the task, execute() will be run entirely in one thread, isn't it?"
If you don't create child tasks directly or indirectly, e.g., through parallel_for(), that execute() call will run entirely in one thread. If you recycle the task, execute() may run in a different thread, but not concurrently.
If you don't create child tasks directly or indirectly, e.g., through parallel_for(), that execute() call will run entirely in one thread. If you recycle the task, execute() may run in a different thread, but not concurrently.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!!! It's clear now!!!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page