Behavior of `Threads.@threads for` loop

The tasks created with @threads are sticky, so, yes, they don’t migrate between Julia threads. You might want to take a look at: Julia 1.7 says it can switch the thread your task is on. How often does that happen, and how can it be disabled? - #4 by carstenbauer.

(The mentioned corner case doesn’t apply to @threads for as the linked documentation mentions itself in the blue note box.)

2 Likes