> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man8/renice.8.md).

# renice.8

`renice` — 修改正在运行进程的优先级

## 名称

`renice`

## 概要

`renice priority [[-gpu] target]` `renice -n increment [[-gpu] target]`

## 描述

`renice` 工具用于修改一个或多个正在运行进程的调度优先级。以下 `target` 参数将被解释为进程 ID（默认）、进程组 ID、用户 ID 或用户名。对进程组执行 renice 会使该进程组中的所有进程的调度优先级都被修改。对用户执行 renice 会使该用户拥有的所有进程的调度优先级都被修改。

可用选项如下：

**`-n`** 不将指定进程改为给定优先级，而是将后续参数解释为增量，加到每个进程的当前优先级上。

**`-g`** 将 `target` 参数解释为进程组 ID。

**`-p`** 将 `target` 参数解释为进程 ID（默认）。

**`-u`** 将 `target` 参数解释为用户名或用户 ID。

非超级用户只能修改自己所拥有进程的优先级，并且只能在 0 到 `PRIO_MAX`（20）范围内单调递增其“nice 值”。（这可以防止绕过管理员的设定。）超级用户可以修改任何进程的优先级，并将其设置为 `PRIO_MIN`（-20）到 `PRIO_MAX` 范围内的任意值。常用的优先级有：20（受影响的进程仅在系统中没有其他进程想要运行时才会运行）、0（“基本”调度优先级）、任何负值（用于让任务运行得非常快）。

## 文件

**/etc/passwd** 用于将用户名映射到用户 ID

## 实例

修改进程 ID 为 987 和 32 的进程，以及用户 daemon 和 root 拥有的所有进程的优先级。

```sh
renice +1 987 -u daemon root -p 32
```

## 参见

[nice(1)](/man/man1/nice.1.md), rtprio(1), getpriority(2), setpriority(2)

## 标准

`renice` 工具遵循 IEEE Std 1003.1-2001（“POSIX.1”）。

## 历史

`renice` 工具出现于 4.0BSD。

## 缺陷

非超级用户无法提高自己进程的调度优先级，即使是最初降低这些优先级的也是他们自己。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man8/renice.8.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
