LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-30-2011, 08:05 AM   #1
choconlangthang
LQ Newbie
 
Registered: Dec 2010
Posts: 8

Rep: Reputation: 0
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.
 
Old 11-30-2011, 08:12 AM   #2
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
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.
 
Old 11-30-2011, 08:42 AM   #3
choconlangthang
LQ Newbie
 
Registered: Dec 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Proud View Post
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.
 
Old 11-30-2011, 01:35 PM   #4
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
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?
 
Old 11-30-2011, 10:41 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run multiple X server in single terminal in linux greensuman Linux - Software 3 12-12-2010 07:34 AM
How force multiple processes to run on separate processors? shahhe Linux - Software 3 09-04-2010 07:40 PM
[SOLVED] Safe way to force load on cpu/gpu? damgar Linux - Software 10 12-19-2009 09:07 AM
Ash script to force-run a browser DragonM15 Programming 4 01-17-2009 06:19 AM
Force Linux to run shell script in FIFO manner _hadi_ Programming 3 12-17-2006 02:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration