Runtime.getRuntime().availableProcessors()) and threads
 807589Sep 7 2006 — edited Jul 16 2008
807589Sep 7 2006 — edited Jul 16 2008Hi
Im using java to find out how many cpu cores a machine have.
i use this code in my program:
Runtime.getRuntime().availableProcessors());
when running on my machine(with 1 cpu core) in linux i get out 2. 
when running in windows i get 1, which is correct. why do i get wrong answer in linux?
is there some other way to find out this, that work both in linux and windows?
question 2:
when starting several threads on a machine with multiple cpu cores. do java use both cores, or could it happend that all threads run on one core?
if someone have links on this topic. please post them.