Runtime.getRuntime (). AvailableProcessors ()

I am trying to check the performance of a program. I refer to this post, getting system information at the OS level . When Runtime.availableProcessors() , I get a 4 response. I am reading availableProcessors (), but it reports that this method returns the number of processors

  1. Can someone explain what the number of processors means?
  2. Why is the result 4?

I am using Windows 7 core i5 4gp.

+10
java performance windows runtime
source share
5 answers

The number of processors is basically the number of executable mechanisms that can run your code. One of the i5 options is the i5-7 quad-core processor. These can be physically different processors (even if they exist inside the same chip), or they can be logical processors when you use hyperthreading.

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

+15
source share

As you read, accessible number of processors available to the JVM () is a method that returns number of processors available to the JVM . 4 indicates the number of processors currently available for the JVM.

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

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

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

+15
source share

You have a multi-core processor (in your case, it looks like Lynnfield ). Each core is calculated as a separate processor (separate processor) for information, since each core can execute instructions simultaneously with the others.

+3
source share

It does not provide any cores available for the jvm process. it may be larger than the actual if hyperthreading is enabled.

+3
source share

In this context, “processor” is “independent execution hardware”, that is, the cpu core.

This is not a "processor package" - a single hardware unit that you buy (these are actually 4 independent processors in one package)

0
source share

All Articles