Note that the OP is asking about threads, not processors, which are two separate things. There’s already a discussion with some explanation and the relevant manual links here: How to change the number of threads? - #7 by BeastyBlacksmith
A simple way to do this is to just use Juno which automatically starts with NUM_THREADS
set to the number of physical cores as default setting.
EDIT: I should have looked more closely at the topic title So the title asks about processors, while the MWE given in the post looks at threads. For processors the answer above will work, similarly it is possible to set them after Julia has been started (which isn’t possible for the number of threads):
julia> using Distributed
julia> nprocs()
1
julia> addprocs(4)
4-element Array{Int64,1}:
2
3
4
5
julia> nprocs()
5
julia> Threads.nthreads()
1