What is a zombie process or thread, and what creates them? Do I just kill them, or can I do something to get diagnostics about how they died?
What is a zombie process or thread, and what creates them?
A zombie process is a dead processes.
The OS is just keeping information around so the parent can check the exit code of the processes at some later point as such the OS keeps information about them and thus they turn up when looking at processes.
Do I just kill them,
No. They are already dead.
The OS will clean up when the parent dies or gets the status code from the OS.
or can I do something to get diagnostics about how they died?
No. The parent can but not the shell.
A zombie thread is a thread that have terminated its execution but didn't terminated cleanly. It deallocates the resources used by the thread but keeps an entry in the thread/process table.
Theoretically, the zombie thread exits from this status by executing a _join (POSIX). It means that when your main is finished, the zombie process would be killed with the program.
A zombie process is a process that has both terminated its execution and has been removed from the list of scheduled processes, but has not yet been deleted. Depending upon the OS, tt might or might not still have various resources assigned to it, and may be queried, but it will not run.
Some OS'es (by design) are not allowed to dynamically create or delete resources beyond a certain event point (VxWorks Cert for example). Such systems often work around this limitation by using pre-allocated pools of resources from which they retrieve, return and reuse items. However, when a process on such a system terminates, it can not be deleted and will instead become zombified (terminated and removed from the scheduling list).
Hope this helps.
When the thread/process is killed, but there is still a record in the corresponding table about it, it becomes a zombie.
This can happen when, for example, a parent process creates a child process, but terminates before the child. When the child process terminates, it tells it's parent about terminating. Afterwards the record of the child process is removed from the corresponding table. But it's parent has already terminated, so the record still remains in the table.
There is no way to get rid of zombies but reboot the