For those of you who are happy tinkering with you cpu and looking under the hood, here is s small application you might find interesting.
cpulimit is a simple program that 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.
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 install, download the latest version from here then then extract the source and compile with make:
tar zxf cpulimit-xxx.tar.gz
Executable file name is cpulimit. You may want to copy it in /usr/bin.
Read more about usage examples and caveats here.