# Multithreads in REPL

**URL:** <https://discourse.julialang.org/t/multithreads-in-repl/79792>\
**Category:** New to Julia\
**Created:** [April 21, 2022, 2:56pm UTC](https://discourse.julialang.org/t/multithreads-in-repl/79792 "2022-04-21T14:56:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brian1/32/49250_2.png) [@Brian1](https://discourse.julialang.org/u/Brian1)\
**Post date:** [April 21, 2022, 2:56pm UTC](https://discourse.julialang.org/t/multithreads-in-repl/79792/1 "2022-04-21T14:56:17Z")

</div>

I usually use Julia in Jupyter. While using `Threads.@spawn`, the threads of jupyter is occupied. Then, untie the whole task is finished, I can not do anything.  
So, is there a way I can forbbidden Threads.@spawn using #1 threads?

---

<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:** [April 21, 2022, 3:30pm UTC](https://discourse.julialang.org/t/multithreads-in-repl/79792/2 "2022-04-21T15:30:33Z")

</div>

Well, if there is just one Julia thread, it is this only thread that needs to do the work. Dropping the `Threads.@spawn` is not going to help: the computation still needs to run somewhere.

Quite the opposite actually. If you start your IJulia kernel with multiple threads (see [here](https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels)), than `@spawn` is going to be useful in having the computation run on a “worker thread”.

(You might want to check out [ThreadPools.jl](https://github.com/tro3/ThreadPools.jl)’s `@tspawnat` (or `@bthreads`) to actually enforce that the computation runs on a “worker thread” and not on the “master thread”.)

---

<div class="post-metadata">

**Author:** ![Brian1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brian1/32/49250_2.png) [@Brian1](https://discourse.julialang.org/u/Brian1)\
**Post date:** [April 22, 2022, 4:34am UTC](https://discourse.julialang.org/t/multithreads-in-repl/79792/3 "2022-04-22T04:34:14Z")

</div>

Thanks for you.
