RENICE(8) | System Manager's Manual | RENICE(8)

# NAME

`renice` — alter priority of running processes

# SYNOPSIS

`renice` | priority [[`-gpu`] who ...] ...

`renice` | `-n` increment [[`-gpu`] who ...] ...

# DESCRIPTION

`renice` alters the scheduling priority of one or more running processes. The first argument is the new priority to apply, or if `-n` is given, the change to make (applied additively) to the priority. This argument may be negative. (The interpretation of priorities is discussed below.)

The following who parameters name the target processes, as either process IDs, process group IDs, or user names. The `-gpu` options control the interpretation as follows:

`-g`
  Interpret who parameters as process group ID's.
`-p`
  Interpret who parameters as process IDs. This is the default.
`-u`
  Interpret who parameters as user names.

Each who parameter is processed separately and updates the priority of the processes it names as follows:

with `-g`
  All processes in the process group are updated to the selected priority. If an increment is used, the increment is added to the highest priority found among the members of the process group prior to the change.
with `-p`
  The named process is updated to the selected priority. If an increment is used, the increment is added to the process's previous priority.
with `-u`
  All processes belonging to the specified user are updated to the selected priority. If an increment is used, the increment is added to the highest priority found among the processes belonging to the user prior to the change.

In conventional terminology a “high priority” process receives a lot of CPU time and a “low priority” process receives relatively little. “Niceness” is the inverse concept: a process with a high niceness level receives relatively little CPU time. It is about the process being nice to the rest of the system, rather than the system being nice to the process.

The numerical priority values accepted by `renice` are called priorities but are actually nicenesses. They range from `PRIO_MIN` (-20) to `PRIO_MAX` (20). `PRIO_MIN` is the highest priority, lowest niceness, and receives the most CPU time. `PRIO_MAX` is the lowest priority, highest niceness, and receives the least CPU time. This is confusing but enshrined in historical practice and standards. If in doubt, check with ps(1): processes running with elevated priority (getting more CPU time) include ‘<’ in the FLAGS column; processes running with reduced priority (getting less CPU time) show ‘N’ for “nice” in FLAGS. The default priority is 0.

At priority 20, processes will specifically run only when nothing else wants to.

Users other than the super-user may only alter the priority of processes they own, and only by increasing the niceness. (This prevents overriding administrative fiats.) The super-user may alter the priority of any process to any legal value.

# FILES

/etc/passwd
  to map user names to user ID's

# EXAMPLES

    renice +1 987 -u daemon root -p 32

changes the priority of process ID's 987 and 32, and all processes owned by users daemon and root.

# SEE ALSO

nice(1), prenice(1), getpriority(2), setpriority(2)

# HISTORY

The `renice` command appeared in 4.0BSD.

# BUGS

Non-super-users cannot increase scheduling priorities of their own processes, even if they were the ones that decreased the priorities in the first place.

October 22, 2020 | NetBSD 10.99