0

My processor is Intel® Core™ i7-3610QM Processor (6M Cache, 2.30 GHz), which posseses 4 processor cores and 8 number of threads (what should that exactly mean?). I'm running a simple Java programm to find out the number of "processors available to the Java virtual machine." (API from Oracle, Java 7), which returns 8 for me, and not 4. Can someone explain me why is that so?

Here is the simple java code:

public class MyTest {
    public static void main(String args[]) {
        System.out.println("Number of cores available : " + Runtime.getRuntime().availableProcessors());
    }
}
Ivaylo Toskov
  • 3,911
  • 3
  • 32
  • 48

1 Answers1

3

This is more of a hardware question IMO.

Your processor is four physical cores, plus something called "Hyper-Threading," which essentially means "tell the system you really have eight cores, even though you have four." According to Intel, this results in a 10-20% performance improvement over just expressing it as four cores.

What you're seeing is what the OS sees: eight cores. Physically, it's four cores, plus hyper-threading.

You may want to see this answer on a similar question, which states:

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.

Community
  • 1
  • 1
ashes999
  • 9,925
  • 16
  • 73
  • 124
  • 1
    Hyerthreading is more than just faking the number of cores. There's some actual logic at the front end of the architecture which allows faster context switching. – Marko Topolnik Dec 10 '13 at 14:56
  • @MarkoTopolnik that is a good point. I don't think the actual details are relevant here though. – ashes999 Dec 10 '13 at 14:58