您需要研究一下Nice和renice实用程序。要为您的进程提供更高的 CPU 优先级,您必须拥有 root/sudo 权限。您可以使用nice
较高优先级启动该进程,也renice
可以随后将其更改为较高优先级。
(terminal1):~# nice -n -10 sleep 100
(terminal2):~# top -b -n1 | grep sleep
23580 root 10 -10 4508 1244 1156 S 0.000 0.008 0:00.00 sleep
(terminal1):~# sleep 100
(terminal2):~# top -b -n1 | grep sleep
23888 root 20 0 4508 1316 1228 S 0.000 0.008 0:00.00 sleep
(terminal2):~# renice -n -10 23888
23888 (process ID) old priority 0, new priority -10
(terminal2):~# top -b -n1 | grep sleep
23888 root 10 -10 4508 1356 1268 S 0.000 0.008 0:00.00 sleep
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1939 次 |
最近记录: |