renice - 更改运行的进程的优先级
renice [-n increment] [-i idtype] ID...
renice [-n increment] [-g | -p | -u] ID...
renice priority [-p] pid... [-g gid]... [-p pid]... [-u user]...
renice priority -g gid... [-g gid]... [-p pid]... [-u user]...
renice priority -u user... [-g gid]... [-p pid]... [-u user]...
renice 命令更改一个或多个运行的进程的调度优先级。缺省情况下,按进程 ID 指定将受影响的进程。
如果第一个操作数是有效优先级范围(-20 到 20)内的数字,renice 会将其视为 priority(与除第一种用法概要形式以外的所有形式相同)。否则,renice 会将其视为 ID(与第一种用法概要形式相同)。
Users without the {PRIV_PROC_PRIOCNTL} privilege may only alter the priority of processes they own, and can only monotonically increase their “nice value” within the range 0 to 19.这样可防止覆盖管理命令。Users with the {PRIV_PROC_PRIOCNTL} privilege may alter the priority of any process and set the priority to any value in the range -20 to 19.Useful priorities are: 19 (the affected processes will run only when nothing else in the system wants to); 0 (the “base” scheduling priority),; and any negative value (to make things go very fast). 20 is an accepted as a nice value, but will be rounded down to 19.
renice 支持以下选项功能:
第一个操作数 priority 必须在选项前面,并可包含多位数选项。
–g、–p 和 –u 选项可分别包含多个选项参数。
pid 选项参数可不与其 –p 选项一起使用。
–i 选项可用于为 ID 列表指定 ID 类型。这是使用 –g | –p | –u 语法指定 ID 类型的首选项,现已过时。请参见“附注”部分。
支持以下选项:
将所有操作数或仅 gid 参数解释为无符号十进制整数进程组 ID。
此选项与 ID 列表参数共同指定要应用 renice 命令的进程类。对 ID 列表的解释取决于 idtype 的值。有效 idtype 参数包括:pid、pgid、uid、gid、sid、taskid、projid 和 zoneid。
指定如何调整一个或多个指定进程的系统调度优先级。increment 选项参数是一个正的或负的十进制整数,将用于修改一个或多个指定进程的系统调度优先级。正 increment 值会导致系统调度优先级较低。负 increment 值可能需要相应的特权,并会导致系统调度优先级较高。
将所有操作数或仅 pid 参数解释为无符号十进制整数进程 ID。如果未指定任何选项,则 –p 选项为缺省值。
将所有操作数或仅 user 参数解释为用户。如果某个现有用户的用户名等于操作数,将使用该用户的用户 ID 执行进一步的处理。否则,如果操作数表示无符号十进制整数,将用它来作为用户的数字用户 ID。
支持下列操作数:
进程 ID、进程组 ID 或用户名/用户 ID,具体取决于选定的选项。
指定的值将被视为实际系统调度优先级,而不是作为现有系统调度优先级的增量。指定高于现有进程优先级的调度优先级可能需要相应的特权。
调整系统调度优先级,以便确保进程 ID 987 和 32 具有较低的调度优先级:
example% renice -n 5 -p 987 32示例 2 调整组 ID 的调度优先级。
调整系统调度优先级,以便确保组 ID 324 和 76 具有较高的调度优先级(如果用户具有相应的特权执行此操作):
example% renice -n -4 -g 324 76示例 3 调整用户 ID 和用户名的调度优先级
调整系统调度优先级,以便确保数字用户 ID 8 和用户 sas 具有较低的调度优先级:
example% renice -n 4 -u 8 sas
有关影响 renice 执行的以下环境变量的说明,请参见 environ(7):LANG、LC_ALL、LC_CTYPE、LC_MESSAGES 和 NLSPATH。
将返回以下退出值:
成功完成。
出现错误。
有关下列属性的说明,请参见 attributes(7):
|
nice(1), passwd(1), priocntl(1), attributes(7), environ(7), privileges(7), standards(7)
The renice syntax
renice [-n increment] [-i idtype] ID ...
优先于旧语法
renice [-n increment] [-g | -p| -u] ID ...
现已过时。
如果将优先级设置为极低的负值,将不能中断进程。
要重获控制权,必须使优先级高于 0。
特权用户以外的用户不能提高其自身进程的调度优先级,即使最初由他们降低优先级也是如此。
priocntl 命令包含 renice 的函数。