renice (修改运行进程的优先级)

瑞兹 发表于 2020-11-19 09:36
浏览次数:
在手机上阅读

在类似Unix的操作系统上,renice命令修改运行进程的优先级。它与nice命令相似,但是用于已经在运行的进程。

查看英文版

目录

1 renice 运行系统环境

2 renice 描述

3 renice 语法

4 renice 例子

renice 运行系统环境

Linux

renice 描述

renice更改一个或多个正在运行的进程的调度优先级。

较高的优先级值实际上会使进程的优先级较低;这意味着该过程将需要较少的系统资源(因此是一个“更精细”的过程)。较低的优先级值表示该进程将需要更多资源,可能会将这些资源拒绝给“更小”的进程。

任何给定进程的优先级值可以从-20(最高优先级,最小“ nice”)到20(最低优先级,“ nicest”)不等。默认情况下,新进程的默认优先级0

renice处理组会导致更改组中的所有进程的调度优先级。

renice使用用户会导致该用户拥有的所有进程的调度优先级均发生更改。

默认情况下,受影响的进程由其进程ID指定。

renice alters the scheduling priority of one or more running processes.

A higher value of priority actually makes the process lower priority; it means that the process will demand fewer system resources (and therefore is a "nicer" process). A lower priority value means that the process will demand more resources, possibly denying those resources to processes that are "nicer".

The priority value of any given process can vary from -20 (highest priority, least "nice") to 20 (lowest priority, "nicest"). The default priority of new processes, by default, is 0.

renice'ing a process group causes all processes in the process group to have their scheduling priority altered.

renice'ing a user causes all processes owned by the user to have their scheduling priority altered.

By default, the processes to be affected are specified by their process ID's.

查看英文版

查看中文版

renice 语法

renice [-n] priority [[-p] pid who...] [[-g] pgrp who...] [[-u] user who...]
renice -h | -v

选件

-n,--priority 流程,流程组或用户的调度优先级。
-g,-- pgrp 强制将谁的参数解释为进程组ID。
-u--user 强制将who参数解释为用户名。
-p,-- pid who解释重置为(默认)进程ID。
-v,-- version 显示版本信息,然后退出。
-h--help 显示帮助消息,然后退出。

优先

除超级用户之外的其他用户只能更改其拥有的进程的优先级,并且只能在0PRIO_MAX20)范围内单调增加其“ nice值” 。超级用户可以更改任何进程的优先级,并将优先级设置为PRIO_MIN-20)到PRIO_MAX范围内的任何值。

优先级的有用设置包括:

  • 20:仅当系统中没有其他资源需要时,受影响的进程才会运行。 
  • 0:默认值。
  • 任何负值:将使事情发展非常快,而以其他过程为代价。
renice [-n] priority [[-p] pid who...] [[-g] pgrp who...] [[-u] user who...]
renice -h | -v

Options

-n--priority The scheduling priority of the process, process group, or user.
-g--pgrp Force who parameters to be interpreted as process group ID's.
-u--user Force the who parameters to be interpreted as user names.
-p--pid Resets the who interpretation to be (the default) process ID's.
-v--version Display version information, and exit.
-h--help Display a help message, and exit.

Priority

Users other than the superuser may only alter the priority of processes they own, and can only monotonically increase their "nice value" within the range 0 to PRIO_MAX (20). The superuser may alter the priority of any process and set the priority to any value in the range PRIO_MIN (-20) to PRIO_MAX.

Useful settings for priority are:

  • 20: the affected processes will run only when nothing else in the system needs the resources. 
  • 0: the default. 
  •  any negative value: will make things go very fast, at the expense of other processes.

查看英文版

查看中文版

renice 例子

renice +1 987 -u daemon root -p 32

将进程ID 98732以及用户守护程序root拥有的所有进程的优先级更改为比其当前值大(+1,增加一个“更细”)。

renice +1 987 -u daemon root -p 32

Change the priority of process IDs 987 and 32, and all processes owned by users daemon and root, to be one greater (+1, one increment "nicer") than its current value.

查看英文版

查看中文版

其他命令行

replace | rm | rmdir | rn | route | rcp | readlink | rehash | rsh | rlogin | rmmod |

如此好文,分享给朋友