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

Does TBB support blocking tasks?

jczhang_bj
Beginner
296 Views
Hi,
I'm new to TBB.I have tasks that may be blocking (for example, reading data from a remote machine, that is very slow) ornon-blocking (only doing local computations, that is fast). At runtime, I can know whether a task is blocking or non-blocking.
I want to have a scheduler that can swap out blocking tasks, and continue with other non-blocking tasks. Once requirements for a blocking task are met, the scheduler can resume the task.
Does TBB support that?
If not, which part of TBB should I look at to add this functionality?
Thanks!
-- Zhang
0 Kudos
2 Replies
RafSchietekat
Valued Contributor III
296 Views
To avoid undersubscription, do not let tasks block for a significant amount of time.

Try to work around this yourself for now, perhaps by making the blocking condition a dependency that is decremented when a dedicated thread serving the outstanding request determines that it has been serviced.
0 Kudos
Alexey-Kukanov
Employee
296 Views
For now, TBB does not support well what you call blocking tasks. We recommend to use dedicatedthreads for things that can block for a while.
0 Kudos
Reply