Runtime.getRuntime().availableProcessors()

java, performance, runtime, windows

Solution

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.

Problem

I am trying to check the performance of a program. I refer this post get OS-level system information. When `Runtime.availableProcessors()` executes, I get an answer of 4. I read availableProcessors() but it tells that this method returns number of processors - Can anyone explain what is mean by number of processors ? - Why am getting 4 as result ? I am using Windows 7 core i5 4gp.

Original source

Related problems