Count running processes and threads - Linux

This is a discussion on Count running processes and threads - Linux ; Hi all, I have a little question. I have to find out how much processes and threads are running at a linux system. When starting my research, I found a documentation about the file loadavg in the /proc filesystem from ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Count running processes and threads

  1. Count running processes and threads

    Hi all,
    I have a little question. I have to find out how much processes and
    threads are running at a linux system. When starting my research, I
    found a documentation about the file loadavg in the /proc filesystem
    from RedHat.
    http://www.redhat.com/docs/manuals/l...-topfiles.html
    It says that I can find the number of running processes there. But the
    number of processes in this file is about 10 processes higher than the
    output of top, ps and pstree. The directories of the processes in the
    /proc filesystem agree with the tools top, ps and pstree.
    When reading the sources I saw that the name of the variable that is
    used for writing the entry in loadavg is nr_thread.
    So my question is what does the number in loadavg tell me? How do I find
    out how much processes and threads are running on my system?
    Thanks in advance
    Michael

  2. Re: Count running processes and threads


    Michael Schindler wrote:

    > So my question is what does the number in loadavg tell me? How do I find
    > out how much processes and threads are running on my system?


    Number of processes:

    ps ax | wc -l
    (subtract one)

    Number of threads:
    ps axm | wc -l
    (subtract one)

    As for what loadaverage means, it's complicated. It's basically the
    number of entities scheduled by the kernel (which more or less means
    threads) that are either waiting for a CPU or blocked on 'fast' I/O.

    DS


  3. Re: Count running processes and threads

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    I hereby accuse davids@webmaster.com of stating:

    > As for what loadaverage means, it's complicated. It's basically the
    > number of entities scheduled by the kernel (which more or less means
    > threads) that are either waiting for a CPU or blocked on 'fast' I/O.


    An intuitive, though not completely accurate, way to think of 'load' in the
    context of 'load average' is the fraction of your processor's power that is
    being demanded at any given time.

    If the load is 1.0, your processor is being used to its complete potential.
    If the load is less than 1.0, your processor has time to spare. If the load
    is more than 1.0, your processor is overloaded and code that is currently
    read to run is being made to wait.

    (The above assumes you have a single processor system. If you have an
    2-processor system, then 2.0 is complete utilization, 3.0 for a 3-processor
    system, etc)

    The three numbers following 'loadavg' are the average load over the last
    minute, five minutes, and fifteen minutes respectively.

    - --
    S. Tyler McHenry

    http://www.nerdland.net/~tyler/info/

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.4 (GNU/Linux)

    iD8DBQFEuEoSyhIpIIGf1i4RAta1AJ9CWHYgr3zkeXgREtvE9w 3G97rTfwCfUU8I
    fiItgg6NoB7OWIl3N4lk36U=
    =SMLD
    -----END PGP SIGNATURE-----

+ Reply to Thread