用 renice 调整运行中进程的优先级
在不重启进程的情况下降低其调度优先级,让它不再抢占系统资源。
运行 renice 10 -p 1234 把该进程调到最低的标准优先级;想温和一点可以用更小的值,比如 renice 5 -p 1234。
01命令
命令
$ renice <priority> -p <PID>02作用说明
renice 会修改正在运行进程的 nice 值:nice 数值越大,调度器分配给它的 CPU 越少,它继续干活的同时其他任务会更流畅。-p 表示目标是进程 ID。你可以随意调低自己进程的优先级(增大 nice 值),但调高优先级(减小 nice 值)或修改其他用户的进程需要 sudo。
03风险
!注意: nice 值只影响 CPU 调度,不影响磁盘和网络 I/O,所以 renice 之后的备份任务仍会大量占用磁盘。不要对系统关键进程使用 renice。
04撤销
撤销
$ renice 0 -p <PID>05来源
- renice(1) man page依据: The page documents renice priority -p pid for adjusting the nice value of running processes and the -p flag that interprets targets as process IDs.
- RENICE(8) — macOS man page依据: The man page documents "-p Interpret target parameters as process ID's (the default)" and shows the example "renice +1 987 -u daemon root -p 32"; it notes only the super-user may alter other users' processes.
最后验证: 2026-09-19 · 分类: 系统与设置