I'm running Hudson on a Windows 7 (x64) machine: this is simply started using 'java -jar hudson.war'. For some reason the java process only uses one cpu, out of 2 available, although it is running multiple threads. I'm pretty sure the default behaviour for the os is to spread the threads of a multi-threaded program across cpu's, unless explicitly told otherwise (using some SetProcessorAffinity api if I remember correctly).

Is there a way to tell java to use multiple cpu's?

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

Normally, java.exe will automatically put threads onto different CPUs.

If it does not, it might be because the program is I/O bound, rather than CPU-bound, or because the threads cannot run concurrently due to synchronization.

See http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#perf_scaling for some more information.

You'll probably have to debug Hudson to know why it uses only one processor.

link|improve this answer
there is indeed lots of IO going on, still not sure that is the only reason though – stijn Nov 3 '10 at 7:35
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.