Do children processes inherit ionice priorities from their parents? How do you check the IO priority of a running process?

15

Ionice is a standard linux command that allows to set the io priority for a process:

http://linux.die.net/man/1/ionice

Do children processes inherit ionice priorities from their parents? How do you check the io priority of a running process?

Peltier

Posted 2009-10-30T14:17:22.373

Reputation: 4 834

Answers

12

Yes. I tested it. IO priority is inherited just like CPU niceness. This is probably what you want. If it isn't, you can explicitly specify the IO priority of child processes with the ionice command.

Ryan C. Thompson

Posted 2009-10-30T14:17:22.373

Reputation: 10 085

9

From the man page (man ionice):

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

Alvin Row

Posted 2009-10-30T14:17:22.373

Reputation: 595

+1 for you since you answered the other half of the question. – Ryan C. Thompson – 2009-11-01T11:39:41.100

7

Any processes that are forked inherit the io class and priority of their parent, however an important fact to keep in mind is that if you alter the io class and/or priority of a running process it doesn't change the io class/priority of any current child processes of that process. That said, once you have adjusted the class and/or priority of a running process, any child processes that are forked going forward will inherit the new io class and priority.

user18364

Posted 2009-10-30T14:17:22.373

Reputation:

1

Yes and this is how I tested it

Create two files foo.sh

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

and 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

Then, run it:

$ bash nicechange.sh 
2549
Before change:idle
Change to best-effort
After changed
best-effort: prio 4
Subprocess
2555 best-effort: prio 4

HVNSweeting

Posted 2009-10-30T14:17:22.373

Reputation: 618