htop has a column called “S” (State) if the state of a process is “Z” (Zombie) that ain’t good

htop states:

  • S for sleeping
    • process is waiting for an event to complete, could be I/O completion, a signal, or some other event
  • I for idle (longer inactivity than sleeping on platforms that distinguish)
    • indicates a process that is idle, often used for kernel threads or processes that are not actively doing anything but are still alive
  • R for running
    • state includes processes is running or about to run and waiting for their turn due to scheduling
  • D for disk sleep (uninterruptible)
    • when a process is waiting for I/O operations to complete, typically disk I/O
    • process should not be interrupted or killed during this state because it COULD be in the middle of a write-to-disk operation
  • Z for zombie (waiting for parent to read its exit status)
    • Also known as a “defunct” process
    • this state indicates that the process has finished executing but still has an entry in the process table
    • happens when e.g. parent process hasn’t yet acknowledged the termination of subprocess by calling `wait()` or `waitpid()`.
    • Zombies consume very little system resources but should be cleared by their parent process or by the system eventually
  • T for traced or suspended (e.g by SIGTSTP)
    • process has been stopped, usually by receiving a `SIGSTOP`, `SIGTSTP`, or `SIGTTIN` signal (Ctrl+Z)
    • can be resumed with `SIGCONT`. This state is used for debugging or when a user manually stops a process
  • W for paging
    • process is waiting for memory to be paged in from disk
    • not commonly seen in modern systems due to advancements in memory management
  • X for terminated
    • This state is rarely seen in `htop` as it represents a process that is in the process of being removed from the system, it is mostly not visible as it will dissappear fast
  • osx does it silmiar but a bit different
# how to find all zombie processes
ps -eo pid,state,command | grep ' Z '
2150 Z [libvirtd] <defunct>
6350 S grep --color Z 

# for some reason libvirtd became unresponsive
# possible reason, check if hostname <-> ip matching is correct in:
vim /etc/hosts

# kill the process
kill -9 2150

list of possible kill signals:

# restart system after modifying hosts and check if the problem is gone
kill -L
1) SIGHUP
2) SIGINT
3) SIGQUIT
4) SIGILL
5) SIGTRAP
6) SIGABRT
7) SIGBUS
8) SIGFPE
9) SIGKILL
10) SIGUSR1
11) SIGSEGV
12) SIGUSR2
13) SIGPIPE
14) SIGALRM
15) SIGTERM
16) SIGSTKFLT
17) SIGCHLD
18) SIGCONT
19) SIGSTOP
20) SIGTSTP
21) SIGTTIN
22) SIGTTOU
23) SIGURG
24) SIGXCPU
25) SIGXFSZ
26) SIGVTALRM
27) SIGPROF
28) SIGWINCH
29) SIGIO
30) SIGPWR
31) SIGSYS
34) SIGRTMIN
35) SIGRTMIN+1
36) SIGRTMIN+2
37) SIGRTMIN+3
38) SIGRTMIN+4
39) SIGRTMIN+5
40) SIGRTMIN+6
41) SIGRTMIN+7
42) SIGRTMIN+8
43) SIGRTMIN+9
44) SIGRTMIN+10
45) SIGRTMIN+11
46) SIGRTMIN+12
47) SIGRTMIN+13
48) SIGRTMIN+14
49) SIGRTMIN+15
50) SIGRTMAX-14
51) SIGRTMAX-13
52) SIGRTMAX-12
53) SIGRTMAX-11
54) SIGRTMAX-10
55) SIGRTMAX-9
56) SIGRTMAX-8
57) SIGRTMAX-7
58) SIGRTMAX-6
59) SIGRTMAX-5
60) SIGRTMAX-4
61) SIGRTMAX-3
62) SIGRTMAX-2
63) SIGRTMAX-1
64) SIGRTMAX

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin