Being Nice on a Linux Box – Process priority with ‘nice’ & ‘renice’ – Nimal’s Weblog
Being Nice on a Linux Box – Process priority with 'nice' & 'renice' – Nimal's Weblog.
Problem (I had): Wanted to run a VirtualBox on a RHEL 4.7 Linux server which is shared by someothers. But as some other processes took more CPU, the VirtualBox performance was bad. So I wanted to increase the priority given to VirtualBox.
Solution (I found): VirtualBox can be given higher priority using nice command. Also renice command can be used to change the priority of a running process, which will also be useful.
nice -10 VBoxHeadless
Gives the VBoxHeadless process 1.5 times priority than the normal process, calculated as (20 – -10)/20 = 1.5
nice -20 make
Executes make at maximum priority.
renice +20 2222
Changes the priority of process 2222 to +20 (minimum priority).
renice -10 -p 13013
Changes the priority of a running process by specifying its process ID, where priority can be,
1 to 20 :Â Runs the specified processes slower than the base priority.
0 :Â Sets priority of the specified processes to the base scheduling priority.
-20 to -1 :Â Runs the specified processes quicker than the base priority.