# How to use many (non-sticky) tasks while maximizing local storage reuse?

**URL:** https://discourse.julialang.org/t/how-to-use-many-non-sticky-tasks-while-maximizing-local-storage-reuse/100279
**Category:** General Usage
**Tags:** multithreading, task\_local\_storage
**Created:** [June 13, 2023, 11:50am UTC](https://discourse.julialang.org/t/how-to-use-many-non-sticky-tasks-while-maximizing-local-storage-reuse/100279 "2023-06-13T11:50:47Z")
**Posts on this page:** 1
**Showing post:** 9

<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: [August 1, 2023, 11:39am UTC](https://discourse.julialang.org/t/how-to-use-many-non-sticky-tasks-while-maximizing-local-storage-reuse/100279/9 "2023-08-01T11:39:25Z")

</div>

> [@lmiq](#):
>
> (You could do the same with `@sync` and `@spawn`, but there would be no advantage here. To improve load balancing you can simply increase the number of chunks (or use the `:scatter` chunking option if there is a correlation between the index of the task and its cost)

Note that `@threads` (or, explicitly, `@threads :dynamic`) isn’t the same as `@sync @spawn`. In particular, perhaps contrary to intuition, the former does **not** implement proper load balancing whereas the latter does. Check out my comment [here](https://discourse.julialang.org/t/multi-threading-appears-to-be-single-thread-when-some-threads-cost-much-more-time-than-the-others/101353/16).

---

_[View the full topic](https://discourse.julialang.org/t/how-to-use-many-non-sticky-tasks-while-maximizing-local-storage-reuse/100279)._
