LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-30-2007, 11:20 PM   #1
lapin3000
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
How can I set CPU max % usage for a process ?


I am trying to figure out how to set CPU max % usage for an individual process. Ex.: I want process "A" to use a max of 20% from the CPU when it runs. I don't really care right now how much CPU max time in seconds it should run, I am only interested in the CPU max usage in %, when the process runs.

Any suggestions ? - Thanks !
 
Old 12-01-2007, 01:56 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
I don't know if it's possible to allocate a percentage of cpu cycles to a particular process. You can set the nice value with the renice command. Lower values (negative) get more cpu time; higher values (positive) get less cpu time.
 
Old 12-01-2007, 02:44 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Well it is possible, but only if you have the latest -rc kernel, and are prepared to play with non-mainline patchsets.
I have only tested on CPU boundaries, not arbitrary percentages.
Might also still be some compatibility issues on NUMA (multi-CPU Opteron motherboards e.g.).

Still a work in progress ...
 
Old 12-01-2007, 07:51 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I'd stick with nice and /or one or more ulimit options if they apply.
 
  


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 get %CPU usage of a process devershetty Linux - Newbie 13 08-16-2008 11:51 AM
how to find max memory usage for process in Linux by command line kashameni Linux - Newbie 9 06-01-2007 01:39 AM
resources: how to limit process to max. 20% CPU usage alesz Linux - Software 4 03-30-2006 02:49 PM
max % of CPU for one process uselpa Slackware 2 07-30-2005 08:21 AM
process cpu usage vanv101 Fedora 9 06-24-2005 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:02 PM.

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