Forcing arena worker-threads to not leave `task_dispatcher::local_wait_for_all` / `task_dispatcher::receive_or_steal_task` loop while program is running
Is there a way to force worker-threads to always spin in local_wait_for_all or receive_or_steal_task loop, and not leaving it when there is no tasks left? How can I achieve it?
Maybe somehow I can force waiter.continue_execution(slot, t) to always return true and poll for tasks? Or I can somehow notify worker-threads that they might need to work soon, so they should start iterating through receive_or_steal_task loop, and then notify them that they should stop spinning and waiting for new tasks?
Hi @blonded04 ,
There is no direct API or methods available to force the threads to always spin in an arena when there are no tasks available. However, you can actually modify the class waiter_base constructor by increasing the yields_multiplier value at the following location: https://github.com/oneapi-src/oneTBB/blob/master/src/tbb/waiters.h#L33 to increase the spin time.
But please note that this has ramifications on the power efficiency of the platform since it prevents the threads from entering a low-power state. Hope it helps!
@blonded04 is this issue still relevant?
@blonded04 is this issue still relevant?
it is, but the question is answered, thank you!