Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.

share|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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .