how do I make java.exe use multiple cpu's?

1

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?

stijn

Posted 2010-11-02T19:59:12.423

Reputation: 1 977

Answers

2

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.

sleske

Posted 2010-11-02T19:59:12.423

Reputation: 19 887

there is indeed lots of IO going on, still not sure that is the only reason though – stijn – 2010-11-03T07:35:31.430