Skip to content

Commit eb92c57

Browse files
update docs
1 parent 4b1c78b commit eb92c57

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

doc/src/manual/multi-threading.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ of Julia multi-threading features.
55

66
## Starting Julia with multiple threads
77

8-
By default, Julia starts up with a single thread of execution. This can be verified by using the
9-
command [`Threads.nthreads()`](@ref):
8+
By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread.
9+
This can be verified by using the command [`Threads.nthreads()`](@ref):
1010

1111
```jldoctest
12-
julia> Threads.nthreads()
12+
julia> Threads.nthreads(:default)
13+
1
14+
julia> Threads.nthreads(:interactive)
1315
1
1416
```
1517

@@ -22,13 +24,20 @@ The number of threads can either be specified as an integer (`--threads=4`) or a
2224
(`--threads=auto`), where `auto` tries to infer a useful default number of threads to use
2325
(see [Command-line Options](@ref command-line-interface) for more details).
2426

27+
See [threadpools](@ref man-threadpools) for how to control how many `:default` and `:interactive` threads are in
28+
each threadpool.
29+
2530
!!! compat "Julia 1.5"
2631
The `-t`/`--threads` command line argument requires at least Julia 1.5.
2732
In older versions you must use the environment variable instead.
2833

2934
!!! compat "Julia 1.7"
3035
Using `auto` as value of the environment variable [`JULIA_NUM_THREADS`](@ref JULIA_NUM_THREADS) requires at least Julia 1.7.
3136
In older versions, this value is ignored.
37+
38+
!!! compat "Julia 1.12"
39+
Starting by default with 1 interactive thread, as well as the 1 worker thread, was made as such in Julia 1.12
40+
3241
Lets start Julia with 4 threads:
3342

3443
```bash
@@ -96,10 +105,17 @@ using Base.Threads
96105
Interactive tasks should avoid performing high latency operations, and if they
97106
are long duration tasks, should yield frequently.
98107

99-
Julia may be started with one or more threads reserved to run interactive tasks:
108+
By default Julia starts with one interactive thread reserved to run interactive tasks, but that number can
109+
be controlled with:
100110

101111
```bash
102112
$ julia --threads 3,1
113+
julia> Threads.nthreads(:interactive)
114+
1
115+
116+
$ julia --threads 3,0
117+
julia> Threads.nthreads(:interactive)
118+
0
103119
```
104120

105121
The environment variable [`JULIA_NUM_THREADS`](@ref JULIA_NUM_THREADS) can also be used similarly:

0 commit comments

Comments
 (0)