# Is the number of threads used by Pluto capped?

**URL:** <https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499>\
**Category:** Pluto\
**Tags:** multithreading\
**Created:** [December 22, 2021, 3:51pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499 "2021-12-22T15:51:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Post date:** [December 22, 2021, 3:51pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499/1 "2021-12-22T15:51:05Z")

</div>

I’m on a Linux box and launched Julia with 16 threads, and then launched Pluto as follows:

 ![Screenshot from 2021-12-22 10-41-22](https://global.discourse-cdn.com/julialang/original/3X/e/6/e6baef7228ad426d9d55ea6f2f817f685bf56d50.png)  
And yet Pluto only seems to have 8 threads available  
 ![Screenshot from 2021-12-22 10-42-30](https://global.discourse-cdn.com/julialang/original/3X/f/2/f2da2a45615fb84db79023135277eb4923366e14.png)

Am I doing something wrong or misunderstanding things? Or is multithreading in Pluto capped at 8 threads, at least for my setup? I’m guessing the former and will be happy to be corrected…

---

<div class="post-metadata">

**Author:** ![Pangoraw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pangoraw/32/24719_2.png) [@Pangoraw](https://discourse.julialang.org/u/Pangoraw)\
**Post date:** [December 22, 2021, 4:03pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499/2 "2021-12-22T16:03:16Z")

</div>

You can specify the number of threads Pluto uses by setting the `JULIA_NUM_THREADS` environment variable or by using the `threads` keyword argument to (ex: `Pluto.run(threads=16)`).

The default value is computed [here](https://github.com/fonsp/Pluto.jl/blob/f9f8542af30491f89606e490d46102ae1406511f/src/Configuration.jl#L149-L158) and is the number of CPU cores divided by two.

---

<div class="post-metadata">

**Author:** ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Post date:** [December 22, 2021, 4:06pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499/3 "2021-12-22T16:06:52Z")

</div>

Ah… That’s great, thank you. I thought the Pluto instance inherited the thread number from the Julia session that launched it.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [April 16, 2024, 10:12pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499/4 "2024-04-16T22:12:54Z")

</div>

> [@Pangoraw](#):
>
> `Pluto.run(threads=16)`)

Sorry to revive an old topic.

This means that those 16 threads are _shared_ across all running notebooks?  
Or that each notebook has its own 16 threads?

---

<div class="post-metadata">

**Author:** ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Post date:** [April 16, 2024, 10:47pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499/5 "2024-04-16T22:47:41Z")

</div>

If it’s not 16 threads for each notebook then are you asking whether i) 2 notebooks would have 8 threads each? Or are you asking ii) if 16 threads are common to the 2 open notebooks and a given notebook can use all or none of the threads depending on the needs of the other notebook? Alternative i) is clearly false because a given notebook can utilize all 16 cores fully even when other notebooks are open. How would you distinguish alternative ii) from the case of 16 threads each, and why would you care? Both situations would allow you to maximize usage of all available cores…

But fwiw, I think that if you launch Pluto notebooks A and B from the same Julia repl (by doing Pluto.run() to open A and then clicking on the three dot Pluto icon to launch notebook B) then notebooks A and B share the 16 threads associated with the Julia session from which you launched the notebooks. But if you launch each notebook from a separate Julia repl then I think they’ll have 16 threads each…

Oh wise and powerful Pluto and Julia gods… Am I right or wrong?

---

<div class="post-metadata">

**Author:** ![danielwe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielwe/32/35657_2.png) [@danielwe](https://discourse.julialang.org/u/danielwe)\
**Post date:** [April 16, 2024, 11:40pm UTC](https://discourse.julialang.org/t/is-the-number-of-threads-used-by-pluto-capped/73499/6 "2024-04-16T23:40:17Z")

</div>

Each Pluto notebook runs in a separate Julia process. There is no sharing of resources between notebooks.
