Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I renice a multithreaded process in Ubuntu 10.04, then view the results in top, it seems that only the main thread actually gets reniced. All the other threads retain their old nice value. What's the easiest way to renice all threads in a process instead of just the main thread?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

renice +/-n -g gid

gid is the process group id which you can find with ps -Aj

share|improve this answer
add comment

The following command can set the nice value to +15 for all threads in process "procid":

ps --no-heading -Lj <procid> | awk '{system("renice +15 "$4)}'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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