Does the JVM have Thread objects attached directly to the processor cores, or is Mapper located between them?

What interests me (and what documentation I find does not help much in determining it) is what happens to the processor core when Thread running on it transfers control to hardware devices (disk controller, network I / O ,. ..) to do some things that the CPU / core cannot handle. Is this kernel available to execute other threads, or is it just stopping and waiting (even if there are other threads with CPU work that are available for scheduling)?

The often-asked "as many threads as cores" tip seems to offer the latter.

+6
source share
1 answer

This is out of control with Java. Planning is done by the OS and therefore outside the scope of the JVM.

It is very likely that the kernel will be restored by the OS when it waits for the IO to complete.

A simple "one thread per core / processor" tip is for intensive CPU operations. If you know that most of the time you expect I / O, you can create more threads than cores.

Also note that the included Hyper-Threading value is calculated by the number of available processors, so a quad-core processor with Hyper-Threading enabled will have 8 available processors (see also this question ).

+1
source

Source: https://habr.com/ru/post/984606/


All Articles