CPU Usage Limiter for Linux What is it? cpulimit is a simple program which attempts to limit the cpu usage of a process (expressed in percentage, not in cpu time). This is useful to control batch jobs, when you don't want them to eat too much cpu. It does not act on the nice value or other scheduling priority stuff, but on the real cpu usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly. News 23 May 2012

CPUlimit has moved to github. Follow me and stay tuned.

23 May 2012

Nerd enough? Check out my new blog :)

29 November 2010

Are you a Londoner? If so, why don't you check out my new project ?

26 August 2010

This is just to say I love open source. I really do. I'm receiving everyday new patches, suggestions, ports, feature requests (and even compliments). This is the strength of open source, it grows thanks to the community.

Keep going! 25 July 2010

Are you a mathematician, physicist, scientist, or just a curious person? Check out my new project thomthom 14 May 2009

Do you like cpulimit? Nominate it as the best tool for sysadmins!

26 November 2008

Abcuser has written a great HOWTO for Ubuntu users. Check it out here! 10 September 2008

A team of researchers is successfully using cpulimit on Mare Nostrum, one of the most powerful computers in Europe. And I'm not kidding :) 7 September 2008

Special thanks to Wyatt for the donation and for providing me a Mac OS X shell. 30 August 2008

I've received a lot of requests for porting cpulimit to Mac OS X. So I've decided to do it, maybe there will be also a GUI. Stay tuned! 10 August 2008

Big thanks to Alexander, who made a huge donation to cpulimit. 16 February 2008

As promised, the subprocesses control implementation is at last in cpulimit svn. Check it out! 10 February 2008

A subversion repository is available thanks to sourceforge.

You can get latest source code (still unstable!) running the command:

svn checkout https://cpulimit.svn.sourceforge.net/svnroot/cpulimit/trunk cpulimit Or you can browse the code from the web interface. 8 February 2008

Started subprocesses control implementation, since a lot of people are asking about this feature. So stay tuned for a new version. 18 January 2007

Now the project is listed on the FSF/UNESCO Free Software Directory. Very glad for that! 26 December 2006

New homepage at http://cpulimit.sourceforge.net 23 December 2006

Source uploaded to sourceforge. 9 August 2006

Started a new project at sourceforge. You can see it here. How it works is a simple program which attempts to limit the cpu usage of a process (expressed in, not in cpu time). This is useful to control batch jobs, when you don't want them to eat too much cpu. It does not act on the nice value or other scheduling priority stuff, but on thecpu usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly. Note that you don't need to read this paragraph in order to use cpulimit, you can safely skip it if you are not interested in tweaking cpulimit.

So, you are curious to know the secrets of cpulimit :) Of course there is no secret if you are a C developer, but I will try to explain to everyone. The work of cpulimit is done all in userspace, so it doesn't interfere with the Linux scheduler. Basically, the target process, which you can specify by pid, name, or command line, is continuosly paused and resumed by sending it SIGSTOP and SIGCONT signals. Signals are sent by cpulimit in appropriate moments, based on the limit specified by user and the process statistics read from /proc.

[To be continued...] System Requirements cpulimit should run on every Linux 2.2 or greater. It has been reported by several users that cpulimit works fine even on SMP hardware, but consider that if you have more than one cpu there is a little difference in the meaning of cpu usage (see below).

If you can modify the source code of cpulimit to make it run in another OS, please notify me, so I can publish your code. I think that the only non-portable code is to iterate through the process list and get process statistics. Instructions Download last stable version from svn checkout https://cpulimit.svn.sourceforge.net/svnroot/cpulimit/trunk cpulimit Then extract the source and compile with make: tar zxf cpulimit-xxx.tar.gz

cd cpulimit-xxx

make Executable file name is cpulimit. You may want to copy it in /usr/bin. Examples of use Limit the process 'bigloop' by executable name to 40% CPU:

cpulimit --exe bigloop --limit 40

cpulimit --exe /usr/local/bin/bigloop --limit 40 Limit a process by PID to 55% CPU: cpulimit --pid 2960 --limit 55 Launch a process by command line and limit it to 40% (in development version only!):

cpulimit --limit 40 /etc/rc.d/rc.boinc start Notes should run on every Linux 2.2 or greater. It has been reported by several users that cpulimit works fine even on SMP hardware, but consider that if you have more than one cpu there is a little difference in the meaning of cpu usage (see below).If you can modify the source code of cpulimit to make it run in another OS, please notify me, so I can publish your code. I think that the only non-portable code is to iterate through the process list and get process statistics.Download last stable version from here or get the latest source code from Subversion repository with this command:Then extract the source and compile with make:Executable file name is cpulimit. You may want to copy it in /usr/bin.Limit the process 'bigloop' by executable name to 40% CPU:Limit a process by PID to 55% CPU:Launch a process by command line and limit it to 40% (in development version only!): If your machine has one processor you can limit the percentage from 0% to 100%, which means that if you set for example 50%, your process cannot use more than 500 ms of cpu time for each second. But if your machine has four processors, percentage may vary from 0% to 400%, so setting the limit to 200% means to use no more than half of the available power. In any case, the percentage is the same of what you see when you run top.

cpulimit should run at least with the same user running the controlled process. But it is much better if you run cpulimit as root, in order to have a higher priority and a more precise control.

Now cpulimit does limit also the children of the specified process. The code is still experimental, so let me know how it is. cpulimit is written just for fun by Angelo Marletta.

Please send your feedback, bug reports, feature requests or just thanks:) to marlonx80 at hotmail dot com