儿童过程是否从父母那里继承了恋爱的优先权?如何检查正在运行的进程的IO优先级?


Answers:



9

在手册页(man ionice)中:

# ionice -p 89 91
Prints the class and priority of the processes with PID 89 and 91.

为您+1,因为您回答了问题的另一半。
瑞安·汤普森

7

分叉的任何进程都将继承其父级的io类和优先级,但是要牢记的一个重要事实是,如果您更改正在运行的进程的io类和/或优先级,则不会更改io类的优先级。该过程的任何当前子过程。就是说,一旦您调整了正在运行的进程的类和/或优先级,以后派生的所有子进程都将继承新的io类和优先级。


1

是的,这就是我测试的方式

创建两个文件 foo.sh

# ==> foo.sh <==
echo $$
ionice

nicechange.sh

# ==> nicechange.sh <==
echo $$
echo -n Before change:
ionice

echo Change to best-effort
ionice -c best-effort -p $$

echo After changed
ionice

echo Subprocess
x=$(bash foo.sh)
echo $x

然后,运行它:

$ bash nicechange.sh 
2549
Before change:idle
Change to best-effort
After changed
best-effort: prio 4
Subprocess
2555 best-effort: prio 4
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.