Jay Roy
asked on
processors count
hi guys
I am trying to find out how many processors i have in my Production server. i am using this code
Runtime.getRuntime().avail ableProces sors();
but does that give a correct count of the number of processors?
What if i have 2 boxes in a cluster and each box has one processor, will the
above code return me correct number of processors.
thanks
I am trying to find out how many processors i have in my Production server. i am using this code
Runtime.getRuntime().avail
but does that give a correct count of the number of processors?
What if i have 2 boxes in a cluster and each box has one processor, will the
above code return me correct number of processors.
thanks
What hardware/software would you have that would allow clustering of processors?
No. I think you mean "nodes" when you write "boxes" in the cluster?! Am I right?
If this is the case then "Runtime.getRuntime().avai lableProce ssors();" will be executed on each one of the boxes, because each box runs it's own JVM.
Btw Runtime.getRuntime().avail ableProces sors(); returns number of the cores of the processor, in your case if you have 1 processor with 4 cores, the returnd value will be "4".
If this is the case then "Runtime.getRuntime().avai
Btw Runtime.getRuntime().avail
ASKER
well the problem is i asked my system admin how many CPUs we are using in Production environment and he says 4
but my java code
>>Runtime.getRuntime().ava ilableProc essors();
returns 1
so i am not sure why there is a mismatch.
However one thing i am pretty sure is it is a production box and it cannot have just one cpu.
so as per my system admin 4 cpus sounds about right.
Thx.
but my java code
>>Runtime.getRuntime().ava
returns 1
so i am not sure why there is a mismatch.
However one thing i am pretty sure is it is a production box and it cannot have just one cpu.
so as per my system admin 4 cpus sounds about right.
Thx.
What OS are you using?
ASKER
Linux OS on production box , no application servers.
Its just a single java program running in one single jvm.
Its just a single java program running in one single jvm.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:)