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.

I host several Rails applications on a VPS using Ubuntu 8.04, Nginx, Passenger, Mysql, RVM, so all the usual suspects.

In the last days it was the first time I really had to debug a problem and look at which processes are running. I could fix the problem using passenger-status and passenger-memory-stats, but I am quite confused by the number of processes running and can't quite figure it out.

Take a look at this screenshot for example: http://screencast.com/t/wUMrmy5iQPQi (taken from htop)

It shows lots of Hudson processes (Hudson is the CI server I am running on that machine).

My questions are:

  • Why are there 34 of them?
  • Are they all separate processes?
  • Are there supposed to be 34 of them or are some of them stale, orphaned processes that didn't shutdown properly on a restart and which I should kill?
share|improve this question

migrated from stackoverflow.com Jan 18 '11 at 7:47

This question came from our site for professional and enthusiast programmers.

    
Wow you are running an old ubuntu version. 10.10 is the current version! –  Alfred Jan 17 '11 at 11:42
    
@Alfred: unfortunately many VPS provider don't support the current Ubuntu versions. Also: the most likely upgrade path from 8.04 would be 10.04, as both are LTS releases. –  Joachim Sauer Jan 17 '11 at 12:58
    
Yep, as Joachim assumed, my host does not let me choose a newer Ubuntu version... would love to update to a more recent one! –  Manuel Meurer Jan 18 '11 at 21:45
add comment

2 Answers

up vote 8 down vote accepted

You are seeing threads. While in htop, press F2 for options then select "Display Options". Check the box for "Hide userland threads" and/or try some of the options in htop like "display threads in a different color"

You may also want to turn on the PPID (parent process id) column. Then you'll be able to tell that all of the threads likely list the same parent process.

share|improve this answer
    
This is not definitely the case; "ps" generally doesn't show threads by default if you use a recent (i.e. not ancient) libc / threads package and 2.6. kernel, which the OP seems to be using. –  MarkR Jan 17 '11 at 12:23
1  
@MarkR while "ps" might not show threads, the tool that the OP IS using, "htop", shows threads by default. This is why my answer is written directly to the tool in question. –  basszero Jan 18 '11 at 0:27
add comment

Linux ps will display separate threads as processes. I don't think there is anything to worry about in that regard.

Try the -L flag to see thread (Lightweight Process) information.

share|improve this answer
    
Nope this is no longer the default. On my distrib ps -e | grep java | wc -l gives 9 results while including the threads with -L (ps -Le | grep java | wc -l) returns 369 results. –  gabuzo Jan 17 '11 at 10:58
    
So all the Hudson lines in the screenshot are threads? Why would I be interested in those instead of the process(es)? And where can I see the actual processes? –  Manuel Meurer Jan 17 '11 at 11:08
    
@gabuzo Agreed - but is it the default under Ubuntu 8? –  trojanfoe Jan 17 '11 at 11:13
    
@zoopzoop I don't have access to a Ubuntu 8 system - I think you'll need to look through the ps manpage. I could be barking up the wrong tree though... :-/ –  trojanfoe Jan 17 '11 at 11:14
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.