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

How do show the current list of processes and threads currently in the run queue?

That is to say, if my server's load average is 32.1, then there were on the average about 32 processes or threads ready to run at any given point in time over the past few minutes. I would like to find out what they are.

Something like ps axHr should do the trick, but on a server with a load average in the 80 range, it shows only 3 or 4 items.

The best I've come up with is ps axH | grep -v " S", but that seems kludgy and fragile, and not even totally correct.

share|improve this question

1 Answer 1

up vote 3 down vote accepted
ps -A -o pid,state,command | awk '{ if ($2 == "R") print }'
 1605 R /usr/bin/skype
30655 R ps -A -o pid,state,command

or use htop and sort(F6) by "S"

or to troubleshoot highload values:

while [ 1 ] ; do ps -A -o pid,state,command | \
   awk '{ if ($2 != "S") print }' | \
   grep -v "ps -A -o pid,state,command" ; sleep 3 ; done
share|improve this answer
    
Note that "R" isn't the only "running" state, many times they'll show up as "D", which still affects your load average –  tylerl Sep 26 '10 at 9:01
    
@tylerl - why did you accept this if it doesn't correctly handle all the various states? –  slm Dec 5 at 20:58

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.