Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

nice(1)

名称

nice - 调用命令并更改调度优先级

用法概要

/usr/bin/nice [-increment | -n increment | --adjustment=increment] command [argument]...
/usr/bin/nice
/usr/xpg4/bin/nice [-increment | -n increment] command [argument]...

csh Builtin

nice [-increment | +increment] [command]

描述

nice 实用程序调用 command,并请求其以不同的系统调度优先级运行。priocntl(1) 命令是更通用的调度程序功能接口。

调用进程(一般为用户的 shell)必须属于支持 nice 的调度类。

If the C shell (see csh(1)) is used, the csh built-in version of nice will be invoked unless the full path of the nice utility is specified.请参见下文的“csh Builtin”部分。

/usr/bin/nice

如果 nice 执行命令时使用参数,则使用缺省的 shell /usr/bin/sh(请参见 sh(1))。

/usr/xpg4/bin/nice

如果 nice 执行命令时使用参数,则使用 /usr/xpg4/bin/sh(请参见 ksh88(1))。

csh Builtin

nice 也是一个 csh 内置命令,其行为不同于实用程序版本。有关说明,请参见 csh(1)

选项

不带任何选项时,nice 实用程序报告当前进程的 nice 级别。

支持以下选项:

increment | –n increment |
––adjustment=increment

increment 是一个正的或负的十进制整数,它会影响实用程序的执行,就像实用程序调用了采用 increment 选项参数数值的 nice() 函数一样。请参见 nice(2)nice() 错误将被忽略,但 EINVAL 除外。如果不指定,则采用增量 10

Running commands with priority higher than normal by using a negative increment such as -10 requires the {PRIV_PROC_PRIOCNTL} privilege.非特权用户指定的负 increment 将被忽略。

––help

显示用法消息并退出。

操作数

支持下列操作数:

command

要调用的命令的名称。如果 command 指定了任何特殊的内置实用程序(请参见 shell_builtins(1)),将会产生无法预料的结果。

argument

在调用 command 时作为参数提供的任何字符串。

环境变量

有关影响 nice 执行的以下环境变量的说明,请参见 environ(7):LANG、LC_ALL、LC_CTYPE、LC_MESSAGES、PATH 和 NLSPATH。

退出状态

如果调用 command,则 nice 的退出状态将是 command 的退出状态。否则,nice 将以下列值之一退出:

1-125

出现错误。

126

找到了 command,但无法调用。

127

找不到 command

属性

有关下列属性的说明,请参见 attributes(7)

/usr/bin/nice

属性类型
属性值
可用性
system/core-os
CSI
Enabled(已启用)
接口稳定性
Committed(已确定)

/usr/xpg4/bin/nice

属性类型
属性值
可用性
system/xopen/xcu4
CSI
Enabled(已启用)
接口稳定性
Committed(已确定)
标准
请参见 standards(7)

另请参见

csh(1), ksh88(1), nohup(1), priocntl(1), renice(1), sh(1), shell_builtins(1), nice(2), attributes(7), environ(7), privileges(7), standards(7)

History

Support for the --adjustment and --help options, as well as for running nice with no options to print the current level, were added to the Solaris nice command in Oracle Solaris 11.4.0.

The –n option and /usr/xpg4/bin/nice command were added to Solaris in Solaris 2.5.

The nice command has been included in all versions of SunOS & Solaris.