Runtime.getRuntime().availableProcessors() Runtime.getRuntime().availableProcessors() windows windows

Runtime.getRuntime().availableProcessors()


As you've read, availableProcessors() is a method that returns the number of processors available to the JVM. 4 means the number of processors currently available for JVM.

These lines return the number of logical cores on Windows and in other operating systems.

On a computer with a quad-core Core i7 supporting Hyper-Threading, it will return 8.

On a computer with a quad-core Q6700, this method will return 4.


The number of processors is basically the number of execution engines capable of running your code. One of the i5 variants is a 4-core CPU, the i5-7 series. These may be physically distinct processors (even though they exist inside the same chip) or they may be logical processors when you're using hyper-threading.

See http://en.wikipedia.org/wiki/Intel_Core#Core_i5 and http://en.wikipedia.org/wiki/Hyper-threading for more detail.


You have a multi-core processor (in your case, it looks like it's Lynnfield). Each core counts as a separate CPU (a separate processor) for the purpose of the information, since each core can execute instructions at the same time as the others.