Answer the question
In order to leave comments, you need to log in
How does a java thread select a processor core?
Good day to all.
Let's say we create a pool of sweats and run it to count a complex task.
ExecutorService service = Executors.newFixedThreadPool(12);
for (int i = 0; i < 500; i++) {
service.submit(() -> new DustCounter().countAllDustInRoom());
}
Answer the question
In order to leave comments, you need to log in
Neither Java nor your program distributes process threads in any way.
it is a separate OS kernel service - Operating System Manager .
how the choice of processor for execution is implemented, see the technical documentation for the OS.
Usually, threads are not tied to processors, which is free and they shove them there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question