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

how workers migrate between the arenas?

dan_x_
Beginner
375 Views

hi all, the following words is from Andrey Marochko 's blog:

"It is also important to realize, that there will always be some timeout between the moment the market updates worker quotas, and the moment when workers actually migrate between arenas. This happens because a worker can discover that it needs to leave its current arena in order to join another one only when it is both in its stealing loop (that is does not have tasks in its local task pool) and does not execute a nested parallel algorithm. Thus re-establishing fairness of worker threads distribution may take a noticeable time in some cases."

Obviously, "updates worker quotas" and "workers actually migrate between arenas" are different things; in the source code, I found that "updates worker quotas" was done by function "update_allotment", which was maily called by ‘is_out_of_work’ and ‘advertise_new_work’. But I don't find the place where "workers actually migrate between arenas" in the source code, so how did that happen?

BR,

Xiaoqiang

 

0 Kudos
2 Replies
RafSchietekat
Valued Contributor III
375 Views

At first sight, receive_or_steal_task() will exit with NULL, then local_wait_for_all() exits, then arena::process(), and then market::process() finds a new arena where the thread can do useful work. But don't hold me to that.

0 Kudos
dan_x_
Beginner
375 Views

Raf Schietekat wrote:

At first sight, receive_or_steal_task() will exit with NULL, then local_wait_for_all() exits, then arena::process(), and then market::process() finds a new arena where the thread can do useful work. But don't hold me to that.

Thanks Raf, yes, you are right. I found a while-loop in market::process to switch arenas.

0 Kudos
Reply