LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   linux script, force server to use multiple CPU to run your porgram (https://www.linuxquestions.org/questions/programming-9/linux-script-force-server-to-use-multiple-cpu-to-run-your-porgram-916358/)

choconlangthang 11-30-2011 08:05 AM

linux script, force server to use multiple CPU to run your porgram
 
Hi,
There is a blade server with 16 CPUs (or so), and not used up to its capacity.
Every time I run my program, it just uses 1 CPU and wastes others. Is there any way I can force it to use 2 or more CPUs to run? (I wonder whether we can dictate that using script, I'm a newbie)

My script is just a simple command:

Code:

java myProgram
Hope you guys help me out, tks.

Proud 11-30-2011 08:12 AM

Your program must be multi-threaded to ever be able to be split across multiple cores/processors. That or you run several instances of it against different subsets of your data if possible.

choconlangthang 11-30-2011 08:42 AM

Quote:

Originally Posted by Proud (Post 4538208)
Your program must be multi-threaded to ever be able to be split across multiple cores/processors. That or you run several instances of it against different subsets of your data if possible.

tks for reply. Yes, my program is multi-threaded but still just 1 processor running.

Proud 11-30-2011 01:35 PM

I'm afraid the only extras I can offer is to look into taskset, cgroups, affinity and the specific scheduler choices for your version and configuration of Linux that you're using on this server. Perhaps the relatively-recent 'automatic process grouping' of 2.6.38 is involved, but I'm really not experienced with these things.

The other thing to consider is whether you're sure it really does only use one core and that it isn't an issue with lock contention or even your usage monitoring?

sundialsvcs 11-30-2011 10:41 PM

Are you running a multi-CPU capable kernel? If "only one processor is running," there's a very good chance that the kernel wasn't built for SMP. (SMP = Symmetric Multi-Processing.) Such kernels detect all the CPUs, bring all but one of them to a dead stop, and keep them that way.


All times are GMT -5. The time now is 08:29 AM.