By default (go..) will use twice the number of cores + 42 threads for the thread pool. Is there any way I can set the number of threads, or number of CPUs that the code can use, through setting an environment variable or sth?
On linux machine I can set number of CPU using taskset, e.g.
taskset -c 0,1 my_Java_or_Clojure_program
, although taskset seems not effective on the number returned by (-> (java.lang.Runtime/getRuntime) .availableProcessors)
.
In the current Clojure version of core.async, the thread pool executor is located in the
clojure.core.async.impl.dispatch
namespace. You can alter theexecutor
var and supply a custom thread poolExecutorService
.Note: Core.async is still in alpha, so, hopefully, this will change in the future.