I have a program that spawns multiple threads, all of which do fairly intensive IO, running on the background. I want to set the scheduling class to idle so that it doesn't clog up the system; however, ionice -c3 -p <PID>, where <PID> is the process ID, does not have the desired effect. Although the scheduling class for process <PID> is changed, when I launched iotop, all the threads it had spawned still had the default priority (best-effort level 4).

How do I change the IO priority of a program and all the threads or processes it has spawned on Linux?


ionice can take a process group ID as an argument (-P switch), which, obviously, affects all processes (and threads) in the given process group. Once can find the process group ID by looking at the 5th field of /proc/<PID>/stat (or using ps). This setting is a bit more coarse than what I really wanted, but works well enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.