renice Command

Purpose

Alters the nice value of running processes.

Syntax

renice-n Increment ] [  -g -p -u ID ...

Description

The renice command alters the nice value of one or more running processes. The nice value is the decimal value of the system scheduling priority of a process. By default, the processes affected are specified by their process IDs. When you specify a process group, the request applies to all processes in the process group.

The nice value is determined in an implementation-dependent manner. If the requested increment raises or lowers the nice value of the executed utility beyond implementation-dependent limits, the limit whose value was exceed is used.

If you do not have root user authority, you can only reset the priority of processes you own and can only increase their priority within the range of 0 to 20, with 20 being the lowest priority. If you have root user authority, you can alter the priority of any process and set the priority to any value in the range -20 to 20. The specified Increment changes the priority of a process in the following ways:

Item Description
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.

The renice command maps these values to those actually used by the kernel.

Notes:
  1. If you do not have root user authority, you cannot increase the nice value of processes (even if you had originally decreased their priorities).
  2. You cannot use the renice command to change a process to run at a constant priority. To do this, use the setpriority system call.

Flags

Item Description
-g Interprets all IDs as unsigned decimal integer process group IDs.
-n Increment 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.
-p Interprets all IDs as unsigned integer process IDs. The -p flag is the default if you specify no other flags.
-u Interprets all IDs as user name or numerical user IDs.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion
>0 An error occurred.

Examples

  1. To alter the system scheduling priority so that process IDs 987 and 32 have lower scheduling priorities, enter:
    renice -n 5 -p 987 32
  2. 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
  3. To alter the system scheduling priority so that numeric user ID 8 and user sas have lower scheduling priorities, enter:
    renice -n 4 -u 8 sas

Files

Item Description
/usr/sbin/renice Contains the renice command.
/etc/passwd Maps user names to user IDs.