Limiting the resources of Ubuntu
Limiting resources of specific processes under Ubuntu
On Ubuntu (and on most Linux distributions) you can easily prevent a program to consume all the power of the computer. Here's how:
Limit CPU usage
If an application uses the CPU at 100%, this could block everything. You can limit the process with the cpu limit command. Open a terminal and type:
cpulimit -e process -l 40
In this example this "process" will be limited to 40% maximum.
You can also use the process PID (which can determine top):
cpulimit -p 130 -l 40
There the process with PID 130 would be limited to 40%.
We simply open the program then set the limit.
It may be that you have to install cpulimit before. Refer to your distribution for that. The official website is
http://cpulimit.sourceforge.net/.
Restrict disk access
If an application is using excessive disk drive, the system may crash , You can use the ionice command to solve this issue.
ionice -c3 PID
This command reduces disk access priority of a process (defined by its PID).
We simply open the program then set the limit.
Again it must be installed if it is not. (official site?)
Limiting bandwidth
A good thing is to limit the bandwidth (upload and download).
The command to be uses is trickle. Close program and then launch the command:
trickle -d 90 program
The program will be limited to 90Kbps for download. To limit upload, use the option "-u":
trickle -u 90 program
Here, the program is closed, and is limited from the start. To remove the limitation you must close and re-open it.
Again, you may need to install trickle if it is not set up by default.
http://monkey.org/~marius/pages/?page=trickle