Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Does TBB support blocking tasks?

jczhang_bj
Beginner
167 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
Black Belt
167 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.
Alexey_K_Intel3
Employee
167 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.
Reply