Skip to content

Combining ionice and nice in Linux, and transitive priorities

I want to load use both ionice (I/O priority) and nice (process priority) to start-up a program.

I see variations of this line all over the internet:

ionice -c2 -n7 nice -n19 [my program to run]


nice -n19 ionice -c2 -n7 [my program to run]

Everyone lists it without any elaboration.

My question is… how does ionice (the first program) setting the priorities of nice (the second program), affect the third program (the program I want to run)? Are the priorities transitive when a program starts another program?

A quick test with htop appears to actually confirm that this works correctly. The program run will have 19 niceness in both cases–which is great, it’s what we want to happen. But how is it working?



When you start your program (assuming it’s a simple single-process program), you get 1 process running your program. So far so good.

nice is a special program that start another program with an adjusted niceness. When you start nice -n 19 someprogram the system (actually the shell) starts a new process to execute nice, but that new process does not in turn execute someprogram in a new process: it replaces the current process image (nice) with a new process image (someprogram).

Same with ionice. So nice -n19 ionice -c2 -n7 starts nice first, which does its thing then starts ionice (replacing its own process image), which does its own thing then finally starts someprogram (replacing its own process image), resulting in a single process that has adjusted CPU and IO niceness.

That being said, since a child process inherits whatever nice value is held by the parent at the time that it is forked, it would still be true if nice/ionice did fork a child process.

So :

Are the priorities transitive when a program starts another program?

Yes, in both situations (process image replacement & child process creation).

User contributions licensed under: CC BY-SA
2 People found this is helpful