Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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