Linux小技巧:nice/renice —— 进程优先级管理

版权声明:作者-傲娇天子 博文主页地址:https://blog.csdn.net/qq_41116956 欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢 https://blog.csdn.net/qq_41116956/article/details/82905543

设置vim 1.txt的进程优先级为10:

[root@localhost ~]# nice -10 vim 1.txt

[1]+  已停止               nice -10 vim 1.txt

查询vim 1.txt的进程号:

[root@localhost ~]# ps -aux | grep 1.txt
root      16971  0.0  0.5 153944  5364 pts/0    TN   09:46   0:00 vim 1.txt
root      16982  0.0  0.0 112660   976 pts/0    R+   09:47   0:00 grep --color=auto 1.txt

在top命令中,由进程号查询优先级:

[root@localhost ~]# top - p 16971

如图所示,优先级为10

改变进程优先级:

[root@localhost ~]# renice -12 16971
16971 (进程 ID) 旧优先级为 10,新优先级为 -12

查询优先级:

[root@localhost ~]# top - p 16971

猜你喜欢

转载自blog.csdn.net/qq_41116956/article/details/82905543