# How to do Multithreading the right way?

**URL:** <https://discourse.julialang.org/t/how-to-do-multithreading-the-right-way/107044>\
**Category:** New to Julia\
**Tags:** question, multithreading\
**Created:** [December 2, 2023, 12:50pm UTC](https://discourse.julialang.org/t/how-to-do-multithreading-the-right-way/107044 "2023-12-02T12:50:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melancholic\_Octopus](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Melancholic\_Octopus](https://discourse.julialang.org/u/Melancholic_Octopus)\
**Post date:** [December 2, 2023, 12:50pm UTC](https://discourse.julialang.org/t/how-to-do-multithreading-the-right-way/107044/1 "2023-12-02T12:50:12Z")

</div>

Hi,  
I was trying to learn how to do multi-threading in julia, but everywhere i found just how not to do it  
I need to perform multiple searches in a recursive data structure, and i wanted to try parallelize it. Given it is a recursive data structure, i need to store a refference to a position in the structure for each search  
Nowhere have i found how could i do this, only how should i not do it, could anyone help me?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [December 2, 2023, 5:51pm UTC](https://discourse.julialang.org/t/how-to-do-multithreading-the-right-way/107044/2 "2023-12-02T17:51:25Z")

</div>

This thread has lots of good info.  
[PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads() - General Usage - Julia Programming Language (julialang.org)](https://discourse.julialang.org/t/psa-thread-local-state-is-no-longer-recommended-common-misconceptions-about-threadid-and-nthreads/101274/3)
