Nice
Published on 21 Sep 2003Tags #Linux
The Linux process scheduler allows custom priorities to be attached to a process to provide some metric to decide whether a process deserves more processor time than others.
-
Nice values range from -20 to 19 which represent the highest and lowest priority, respectively. As one would have expected
root
is allowed to set any priority he chooses whereas users will not be able to raise the priority of a process below zero. -
The command
nice
changes the priority of a process upon invocation:nice foobar
. By default, the results in a nice value of 10 which effectively lowers the priority of the process by assigning less processor time. -
The command
renice
adjusts the nice value of a running process, process group or user which results in a change of its priority:-
Changing the nice value of a process:
renice {+|-}NICE -p PID
-
Changing the nice value of a user’s processes:
renice {+|-}NICE -u USER
-
For an in depth discussion, I recommend you read “Linux Kernel Development” by Robert Love.