This tutorial explains Linux “renice” command, options and its usage with examples.
Every running process in Unix has a priority assigned to it.
You can change the process priority using nice and renice utility. Nice command will launch a process with an user defined scheduling priority. Renice alters the scheduling priority of one or more running processes. The following who parameters are interpreted as process ID’s, process group ID’s, or user names. Renice ‘ing a process group causes all processes in the process group to have their scheduling priority altered. Renice ‘ing a user causes all processes owned by the user to have their scheduling priority altered. By default, the processes to be affected are specified by their process ID’s.
renice priority [ -n Increment ][[-p ] pid … ] [[-g ] pgrp … ] [[-u ] user … ]
Specifies the number to add to the nice value of the process. The value of Increment can only be a decimal integer from -20 to 20. Positive increment values cause a lower nice value. Negative increment values require appropriate privileges and cause a higher nice value.
Force who parameters to be interpreted as process group ID’s.
Force the who parameters to be interpreted as user names.
Resets the who interpretation to be (the default) process ID’s.
1. The following will change nice value of process 2243 to 19
# renice 19 2243
2. This would change the priority of process ID’s 987 and 32, and all processes owned by users daemon and root
# renice +1 987 -u daemon root -p 32
Note: The specified Increment changes the priority of a process in the following ways:
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.
3. To alter the system scheduling priority so that group IDs 324 and 76 have higher scheduling priorities (if the user has the appropriate privileges to do so), enter:
# renice -n -4 -g 324 76
(1) Users can only change the nice value of processes which they own.
(2) User cannot start processes with nice values less than 20.
(3) User cannot lower the nice values of their processes after they’ve raised them.
(4) As usual root has full access to renice command.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.