Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-08-2012, 07:44 PM   #1
LQ Newbie
Registered: Mar 2012
Posts: 2

Rep: Reputation: Disabled
Limit cpu percentage for a process

I needed to limit how much cpu a certain process uses to about 50%. I tried cpulimit but it is not working for me on a quad-core system (it says to use values over 100% for multicores but when you enter any value above 100% it doesn't limit at all). Is there any other way to limit a cpu by percentage, or to fix cpulimit so it will work?

Limiting cpu time will not work for me because this particular process im using (tophat) slows down to one core at one point and if I limit cpu time this part will take twice as long which will add an extra few hours...or days..on to my computing time
Old 03-08-2012, 08:46 PM   #2
Registered: Jul 2011
Distribution: arch, vector, mint
Posts: 37

Rep: Reputation: Disabled
I am assuming you are doing this sort of thing in order to make your system usable while doing some heavy duty computation. If this is the case then instead of limiting processing power you could use the nice system. It gives priority to certain tasks and if tasks with higher priority need more power then it is taken from tasks with lower priority. By default most tasks have a nice of 0, but it ranges forom -19 (very important) to 19 (not important). To use this system just use "nice <priority> <command>". I would recommend doing something like this instead of limiting processing power.
Old 03-08-2012, 09:36 PM   #3
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,890

Rep: Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207Reputation: 3207
Have a look a cgroups. You can define a cpuset that limits the CPUS (cores) processes can use. You could limit it to 2 CPUs, and it will never use more. If it only needs one, other tasks can use the CPU (depending on if you declare it as "exclusive" or not).
I do similar for benchmarks - limit them to all except one CPU. I use that other CPU to monitor how things are going without getting locked out.

Last edited by syg00; 03-08-2012 at 09:37 PM.
Old 03-17-2012, 07:56 PM   #4
LQ Newbie
Registered: Mar 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for the replies. The goal is more to just reduce heat than making cpu available for other programs. Niceing might work if I had a dummy program running but I dont know much programming. The program will let me limit number of CPUs, which is best solution now. But after awhile the temps get a little too hot for my liking. Id much rather run four cores at 50% than two at 100%


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
Is there a way to limit a process's CPU usage... trist007 Linux - Newbie 3 08-06-2010 08:18 AM
Need to limit CPU usage of a process jgombos Linux - General 2 01-30-2010 08:04 PM
Percentage of CPU used on a single process Aztral Programming 1 09-04-2009 08:38 AM
CPU utolization in percentage for each process nsyed4 Linux - Newbie 1 12-04-2007 05:51 PM
`top` Irregularities - cpu count, percentage, process lists ColinAnderson Linux - Software 4 05-09-2007 06:41 PM > Forums > Linux Forums > Linux - Newbie

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