Various people:
> ps ax | grep -c '<zombie>'
> ps ax | grep -c '<z[o]mbie>'
> ps acx | grep '<defunct>'
> ps acx | awk '$6 == "<defunct>"'
You can ask ps for what you want:
ps -eo s | grep -c Z # Linux and Solaris
ps -eo state | grep -c Z # Linux and every UNIX except Solaris
ps axo state | grep -c Z # Linux, Tru64, AIX, and some non-UNIX crap
Jos Visser writes:
> The following is wrong with it:
>
> 1) It is too slow
Too bad. For nearly everyone, a fast exit() is far more important.
> 2) It is not full (fool) proof
With my changes it is very reliable.
> 3) It takes too much resources to execute very often in
> a monitoring system that you want to be non-intrusive
"Doctor, it hurts when I do this." --> "Don't do that."
(poll less often, or just don't make zombies)
> 4) It is Linux distribution dependent (ps flags)
You can upgrade ps.
> 5) It is somewhat unwieldy from a C program
Too bad. For nearly everyone, a fast exit() is far more important.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:21 EST