Re: Detecting CPUs and cores



On Mon, 30 Jul 2007 21:59:10 +0100, Joshua Cranmer <Pidgeot18@xxxxxxxxxxx> wrote:

On Mon, 30 Jul 2007 13:25:52 -0500, Chris wrote:

Is there any way for Java to detect the number of CPUs that are
available? Runtime.getRuntime().availableProcessors() returns the number
of cores, not CPUs.

I don't think that is possible. The only OS I have experience with is
Windows, and that treats a dual-core as two CPUs; I believe that *nix
systems do the same as well.

I think that's reasonable behaviour. My dual-core Mac does the same under OS X.

What's slightly less helpful is that my Windows PC at work returns 2 from availableProcessors() despite the fact that it is single-core, albeit with Intel's Hyper-Threading.

Finding out any more about the processors is probably going to require some JNI.

Dan.

--
Daniel Dyer
http//www.uncommons.org
.



Relevant Pages

  • Re: Dual-core systems - AMD - Windows Vista
    ... I'm still trying to resolve NTP on Windows Vista. ... dual-core system, so I was wondering how NTP handled dual-core. ... could be run on different CPUs with different TSCs. ...
    (comp.protocols.time.ntp)
  • Re: Detecting CPUs and cores
    ... of cores, not CPUs. ... Windows, and that treats a dual-core as two CPUs; I believe that *nix ...
    (comp.lang.java.programmer)
  • Double the Power
    ... makers Intel and Advanced Micro Devices entering 2006. ... But despite the dual-core religion, ... Ever-faster CPUs were running so hot that they made ... performance at lower clock rates than their single-core counterparts. ...
    (comp.dcom.telecom)
  • Re: [Full-Disclosure] lame bitching about xpsp2
    ... >*nix way) you still would whine because they are also working on extending ... >are concerned that you will have to learn Windows, ... >I recall nimda and I don't recall my Windows machines getting infected even ... >BeOS isn't going to cause a great desire to learn computers. ...
    (Full-Disclosure)
  • [SLE] Re: SUSE Firewall primitive shadow of ZoneAlarm in interactive user-control
    ... Linux is poor in real-time, ... There is a fundamental difference in the security model and tools available for windows and for linux. ... Linux is descended (in thought and design concept) from unix -- which was designed for multi-user computer sharing -- usually with no one at the console. ... Even Windows as a server isn't designed as *nix has been. ...
    (SuSE)