Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Processes hanging around in ZOMBIE State
Ref. No. QNX.000007981
Category(ies) Development
Issue How do I get rid of processes which are DEAD or in a ZOMBIE state?  I am using the fork() command and I do not want to use qnx_spawn() because it will not pass on the file descriptors, but fork() always leaves Zombies behind.
Solution The DEAD or ZOMBIE process is a process which has terminated, but is unable to send its exit status to its parent because the parent hasn't issued a wait() or waitpid().  A DEAD process has a state, but the memory it once occupied has been released.

After the termination thread is run, notification of process termination is sent to the parent process (this phase runs inside the Process Manager). If the parent process hasn't issued a wait() or waitpid() call, the child process becomes a ``zombie'' process and won't terminate until the parent process issues a wait() or terminates. (If you don't want a process to wait on the death of children, you should either set the _SPAWN_NOZOMBIE flag with qnx_spawn() or set the action for SIGCHLD to be SIG_IGN via signal(). This way, children won't become zombies when they die.)

A parent process can wait() on the death of a child spawned on a remote node. If the parent of a zombie process terminates, the zombie is released. If a process is terminated by the delivery of a termination signal and the dumper utility is running, a memory-image dump is generated. You can examine this dump with the symbolic debugger.