# Julia irresponsive with threads=auto and using ImageView

**URL:** <https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669>\
**Category:** New to Julia\
**Tags:** imageview\
**Created:** [February 7, 2025, 7:37pm UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669 "2025-02-07T19:37:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [February 7, 2025, 7:37pm UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669/1 "2025-02-07T19:37:54Z")

</div>

Hello  
I have noticed that with the switch `--threads=auto` while starting Julia and using package `ImageView` the system has trouble responding to keyboard hits. If I try using up, down, left or right arrows on my keyboard the result is completely unpredictable. I have to wait a little bit before hitting keys, otherwise the display on the screen is not proper. About anything is problematic. I cannot paste a command neither it’s too fast for julia. Even a simple `exit()` take a while to finalize and exit julia.

Weirdest of all: I have the feeling that of I type something in another window totally unrelated to the window where I run julia (like typing this issue in the browser for instance) helps julia. It looks like the multithread option corrupts the interraction with the keyboard. I don’t see any abnormal CPU/RAM usage when julia hangs like that.

I don’t have a packages in the project and I only need load `ImageView` to get the strange behaviour.

I am using Julia 1.11.3 on Windows 11.  
I have the same problem regardless if it is the standard cmd window or the Powershell window.

Damn it! I have the same problem with Ubuntu 24.10.

---

<div class="post-metadata">

**Author:** ![jwahlstrand](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jwahlstrand](https://discourse.julialang.org/u/jwahlstrand)\
**Post date:** [February 7, 2025, 10:58pm UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669/2 "2025-02-07T22:58:06Z")

</div>

This is probably [REPL locks up after `using Gtk4` in julia 1.11 with multiple threads · Issue #78 · JuliaGtk/Gtk4.jl · GitHub](https://github.com/JuliaGtk/Gtk4.jl/issues/78). Does it happen if you call julia with `--threads=auto,1`?

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [February 8, 2025, 1:04am UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669/3 "2025-02-08T01:04:31Z")

</div>

> [@jwahlstrand](#):
>
> Does it happen if you call julia with `--threads=auto,1`?

No. It looks good in that situation.

---

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [February 8, 2025, 10:51am UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669/4 "2025-02-08T10:51:43Z")

</div>

Here `--threads==auto` allows Julia to run on all the _ **threads** _ available in cpu and hence screen freezes. While `--threads==auto,1` keeps `1` thread free for other processes and assigns other threads for Julia use. This is why it does not hang cpu in this case. 😅

---

<div class="post-metadata">

**Author:** ![dgagnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dgagnon/32/45466_2.png) [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Post date:** [February 9, 2025, 12:17am UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669/5 "2025-02-09T00:17:56Z")

</div>

@raman_kumar

> [@raman\_kumar](#):
>
> Here `--threads==auto` allows Julia to run on all the _ **threads** _ available in cpu and hence screen freezes. While `--threads==auto,1` keeps `1` thread free for other processes and assigns other threads for Julia use. This is why it does not hang cpu in this case.

Thanks for the information Raman. However, I am a bit confuse. If I do

```julia
julia --threads=auto,1
              _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.11.3 (2025-01-21)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> using Base.Threads

julia> Threads.nthreads()
20

```

As you can see I have 20 threads available. Given that I have 20 cores in my CPU, it seems that all are available. So, where is the thread **free for other processes**? Further, I don’t understand what you mean by “other processes”. And when you say the remaining ones are for Julia. I understand that they are available **to me for use of my Julia programs**. That’s what `Threads.nthreads()`seems to indicate.  
Could you please elaborate a bit more on what the `=yes,1` value does?

By the way I use `=yes,1` NOT `==yes,1`. Does that make a difference? is it equivalent.

Thanks a lot for your time.

---

<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:** [February 9, 2025, 4:08am UTC](https://discourse.julialang.org/t/julia-irresponsive-with-threads-auto-and-using-imageview/125669/6 "2025-02-09T04:08:03Z")

</div>

You can read more about the two thread pools here: [Multi-Threading · The Julia Language](https://docs.julialang.org/en/v1/manual/multi-threading/#man-threadpools). The argument `--threads=n,m` denotes `n` threads in the `:default` thread pool and `m` threads in the `:interactive` thread pool. (Either or both of `m` and `n` can be `"auto"` to tell Julia to make a choice informed by the hardware you’re running on.)

If you only specify `--threads=n` you get `n` threads in the `:default` pool and _zero_ threads in the `:interactive` pool. In other words, the difference between the two cases you’re considering is whether or not you have a thread reserved for interactive use.
