LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can I set CPU max % usage for a process ? (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-set-cpu-max-usage-for-a-process-603664/)

lapin3000 11-30-2007 11:20 PM

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 !

bigrigdriver 12-01-2007 01:56 AM

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.

syg00 12-01-2007 02:44 AM

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 ...

chrism01 12-01-2007 07:51 PM

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


All times are GMT -5. The time now is 11:41 AM.