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

TBB with Hard / Soft Real Time Apps

amit_l_
Beginner
511 Views

Hi,

1. Can I use TBB in hard-real time applications ?  (if the answer is no, please explain why ?)

2. Can I use TBB in soft-real time applications ?  (if the answer is no, please explain why ?)

It is very importent to explain why or why not.

Thank's :-)

 

0 Kudos
3 Replies
robert-reed
Valued Contributor II
511 Views

Intel Threading Building Blocks uses a unfair scheduler for assigning tasks to threads: any thread can choose on completion of a task what task to perform next, the purpose being to keep related tasks on the same HW threads to preserve any working data in the local caches to reuse rather than having to write changes back to memory and read them into a different HW thread.  Given such a scheduler, it may not be possible to offer real-time response guarantees, hard or soft.

0 Kudos
amit_l_
Beginner
511 Views

Thank's Robert.

Cant I assign theTBB  threads to specific cores ? (core affinity ?), and solve the problem you describe me ?

0 Kudos
robert-reed
Valued Contributor II
511 Views

You could use something like task-scheduler-observer to set thread affinities and lock specific TBB worker threads to particular HW threads.  That still doesn't provide any means to guarantee that a new task will be initiated within a guaranteed interval.  The way work propagates across the worker threads in the scheduler is through task stealing, wherein an idle Intel TBB worker randomly selects other workers looking for work to steal, taking unstarted tasks from a different worker's work queue.  Random search for schedulable work is not a very reliable method on which to base a real-time scheduling guarantee.

0 Kudos
Reply