Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 12-01-2007, 12:20 AM   #1
LQ Newbie
Registered: Dec 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, 02:56 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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, 03:44 AM   #3
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,479

Rep: Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096Reputation: 3096
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, 08:51 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,700

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

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