Re: Detecting CPUs and cores



Lew wrote:
It is likely that the two hyper-threaded cores will achieve more throughput than on one of those "cores". The reason Intel provided hyperthreading is that it increases throughput on the chip.

Daniel Dyer wrote:
That's the theory, but it's less clear cut than with a "proper" dual core chip. There is anecdotal evidence of people turning *off* Hyper-Threading in the BIOS to improve the performance of their applications.

http://news.zdnet.co.uk/hardware/0,1000000091,39237341,00.htm
http://www.javalobby.org/java/forums/t54590.html

I haven't personally benchmarked the effect of Hyper-Threading but, if your application is relying on the result of availableProcessors() to fine tune it's concurrency strategy, it's important to be aware that 1 HT CPU may behave quite differently from 1 dual-core CPU.

There is evidence that multiple CPUs can reduce throughput relative to a single CPU, too. It depends on the software.

I am not arguing that HyperThread is as effective as multiple cores. In fact, HT is a hack devised by Intel to counteract excessive pipeline stalling, so it stands to reason that its performance would differ perhaps significantly from true multiple-CPU scenarios. The trick is to discern when the number of CPUs reported by Java is a reliable number and when it isn't.

My point is that most times to the Java world it doesn't matter. You use the number as reported. Like every performance issue, especially in Java, it is nigh impossible to make /a priori/ judgments about the impact this will have, especially cross-platform /a priori/ judgments. So unless we decide in a particular case that the difference makes a difference, we pretend that it is no difference. To the JVM, a HT (with both "cores" enabled) acts like two CPUs, smells like two CPUs, quacks like two CPUs, so we pretend that it is two CPUs.

Performance optimization comes after the fact.

--
Lew
.



Relevant Pages

  • Re: Performance improvement using X5355 over 5080
    ... would expect to get by swapping 2 x Xeon 5080 3.73GHz Dual-Core CPUs with 2 x Xeon X5355 2.66GHz Quad-Core CPUs? ... you are trading two cores which are 40% faster, ... And at time when you have load, but ony a few threads running, you lose, even if you win under max load. ...
    (comp.sys.intel)
  • Re: Performance improvement using X5355 over 5080
    ... would expect to get by swapping 2 x Xeon 5080 3.73GHz Dual-Core CPUs ... 40% faster, for four cores. ... And at time when you have load, ...
    (comp.sys.intel)
  • Re: Intel details future Larrabee graphics chip
    ... for dinky little SMP systems of 4-8 cores. ... Why multi-thread *anything* when hundreds or thousands of CPUs are ... video CPUs using fancy memory and generics doing the grunt work. ... Duo, and never get trojans, memory leaks, any of that. ...
    (sci.electronics.design)
  • Re: The machdep.hyperthreading_allowed & ULE weirdness in 7.1
    ... I have a single-CPU system with P4 HTT-enabled processor, ... For 4BSD, which uses a "pull" model to bring work from work queues, this means that CPUs will go to sleep and remain that way unless they're actively receiving interrupts. ... The only reliable way to disable hyperthreading is to do so using your BIOS setting, or use loader.conf to disable probing of the pics on unwanted cores, which will cause the CPUs not to be enumerated and hence not used. ... You could imagine teaching ULE about policies such as "Don't use HTT cores", or perhaps just cpuset about those policies. ...
    (freebsd-current)
  • Re: The machdep.hyperthreading_allowed & ULE weirdness in 7.1
    ... I have a single-CPU system with P4 HTT-enabled processor, ... For 4BSD, which uses a "pull" model to bring work from work queues, this means that CPUs will go to sleep and remain that way unless they're actively receiving interrupts. ... The only reliable way to disable hyperthreading is to do so using your BIOS setting, or use loader.conf to disable probing of the pics on unwanted cores, which will cause the CPUs not to be enumerated and hence not used. ... You could imagine teaching ULE about policies such as "Don't use HTT cores", or perhaps just cpuset about those policies. ...
    (freebsd-stable)