LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2010, 06:58 AM   #1
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Rep: Reputation: 15
Question Fixed maximum CPU usage for a process...


Are there a way to set fixed maximum processing power to a process...

For example a program called 'X' uses cpu in high speed. I need to set this 'X' process to to run with maximum 20% of cpu usage at any time.
 
Old 01-31-2010, 07:05 AM   #2
kdelover
Member
 
Registered: Aug 2009
Posts: 311

Rep: Reputation: 36
there is a tool called cpulimit

http://cpulimit.sourceforge.net/
 
1 members found this post helpful.
Old 01-31-2010, 08:20 AM   #3
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Question

I tried out 'cpulimit' sir as you advised. But when there are several instances of same program running it only considers one instance of process of given name. Is there a way to avoid this without using pid and only using process name???

eg: cpulimit -P MyProcess -l 20

This sets cpu max usage for 'MyProcess' upto 20% but when I launch a new instance of 'MyProcess' the cpulimit is not effect for that. I need to set MAX cpulimit 20% all processes called MyProcess whenever it launches or whatever instances it runs...
 
Old 01-31-2010, 09:15 AM   #4
worm5252
Member
 
Registered: Oct 2004
Location: Atlanta
Distribution: CentOS, RHEL, HP-UX, OS X
Posts: 567

Rep: Reputation: 57
Is this "Process" an installed package or a script? If it is a script, what language?
 
Old 01-31-2010, 11:22 PM   #5
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Question

Sir 'worm5252', The 'Process' is my program which is written in C and I need to execute multiple instances of that process ensuring that the process consumes upto maximum 20% processing power. I need to do it externally....not by modifying source code of the program.
 
  


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 fixed CPU usage for a particular application in linux megerdin Linux - General 4 11-01-2009 01:56 AM
How to get %CPU usage of a process devershetty Linux - Newbie 1 08-18-2008 01:52 AM
How to get %CPU usage of a process romydmisc Linux - Newbie 2 05-24-2006 01:02 PM
process cpu usage vanv101 Fedora 9 06-24-2005 05:53 PM
CPU usage of a process asharma Solaris / OpenSolaris 7 03-29-2003 02:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:57 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