Why are there so many processes running?

7,236

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:
7,236

Related videos on Youtube

Manuel Meurer
Author by

Manuel Meurer

I'm the founder of Uplink, a network for IT freelancers in Germany: https://uplink.tech/ Uplink is a simple, fair, and transparent alternative to classic IT recruiters. If you're a freelancer (or a company looking for freelancers) and tired of recruiters wasting your time, come join us! :)

Updated on September 17, 2022

Comments

  • Manuel Meurer
    Manuel Meurer over 1 year

    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?
    • Alfred
      Alfred over 13 years
      Wow you are running an old ubuntu version. 10.10 is the current version!
    • Joachim Sauer
      Joachim Sauer over 13 years
      @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.
    • Manuel Meurer
      Manuel Meurer over 13 years
      Yep, as Joachim assumed, my host does not let me choose a newer Ubuntu version... would love to update to a more recent one!
  • Admin
    Admin over 13 years
    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.
  • Manuel Meurer
    Manuel Meurer over 13 years
    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?
  • Admin
    Admin over 13 years
    @gabuzo Agreed - but is it the default under Ubuntu 8?
  • Admin
    Admin over 13 years
    @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... :-/
  • MarkR
    MarkR over 13 years
    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.
  • basszero
    basszero over 13 years
    @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.