cpulimit is a tool that can be used to limit cpu usage (throttle cpu usage) for a single process (by its PID). cpulimit is useful to ensure that a single process would not hogs the cpu cycles, which can be use by other processes. cpulimit is different from ‘nice’ as it limits the real cpu usage for a process, while ‘nice’ controls scheduling priorities for a particular process.
How to use cpulimit?
cpulimit -p [pid] -l [ cpu percentage]
cpulimit -p 12345 -l 25
Running cpulimit on background:
cpulimit -p 12345 -l 25 -z -b
Note: The cpu percentage is the same one as reported by the ‘top’ command.
cpulimit can be installed from Ubuntu and Debian 6.0 (Squeeze) repository through apt-get. The official website of cpulimit is http://limitcpu.sf.net