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.
- 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?)
A good thing is to limit the bandwidth (upload and download).
- The command to be used is trickle. Close program and then launch the command:
- The program will be limited to 90Kbps for download. To limit upload, use the option "-u":
- 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.
With Wget (single file)
If you want to download just a single file, you can use the basic but powerful wget:
wget --limit-rate=90k http//www.site.org/file.ext
Published by jak58
Latest update on August 14, 2010 at 07:08 AM by jak58.