# Behavior of \`Threads.@threads for\` loop

**URL:** <https://discourse.julialang.org/t/behavior-of-threads-threads-for-loop/76042>\
**Category:** General Usage\
**Tags:** multithreading\
**Created:** [February 8, 2022, 7:31pm UTC](https://discourse.julialang.org/t/behavior-of-threads-threads-for-loop/76042 "2022-02-08T19:31:36Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [February 8, 2022, 9:41pm UTC](https://discourse.julialang.org/t/behavior-of-threads-threads-for-loop/76042/3 "2022-02-08T21:41:04Z")

</div>

The tasks created with `@threads` are [sticky](https://github.com/JuliaLang/julia/blob/a25f128a8fc38eb86f1067316509838d29c8c007/base/threadingconstructs.jl#L31), 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](https://discourse.julialang.org/t/julia-1-7-says-it-can-switch-the-thread-your-task-is-on-how-often-does-that-happen-and-how-can-it-be-disabled/75373/4).

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

---

_[View the full topic](https://discourse.julialang.org/t/behavior-of-threads-threads-for-loop/76042)._
