Operating System - HP-UX
1821247 Members
2663 Online
109632 Solutions
New Discussion юеВ

Zombie & defunct processes

 
SOLVED
Go to solution
Luis Miguel Parra Chica
Occasional Advisor

Zombie & defunct processes

Hi all,

I need your help in reference to such a problem. One binary file is giving defunct childs. Example:
# ps -ef|grep defunct
axadmin 23256 23251 1 12:04:58 ? 0:00

Looking for help in man I see:
________________________________
A process that has exited and has a parent, but has not yet been waited for by the parent, is marked (see zombie process in exit(2)).
-----------------------------
If the parent process of the calling process is not executing a wait(), wait3(), or waitpid(), and does not have SIGCLD set to SIG_IGN, the calling process is transformed into a zombie process. A zombie process is a process that only occupies a slot in the process table. It has no other space allocated either in user or kernel space.
The parent process ID is set to 1 for all of the calling process's existing child processes and zombie processes. This
means the initialization process (proc1) inherits each of these processes.
Threads/LWPs terminated by a call to exit() shall not invoke their cancellation cleanup handlers or their thread specific data destructor functions.

My questions are:
- Differences between zombie & defunct process. Doing "top" I notice how many zombies are, but doing "ps" I only see defunct.
- Really a zombie process only spend one entry in the kernel process table? No more performance affaires???
- Is the zombie caused by parent code that is not waiting for the exit of their childs? So the only cause is source code, Can the administrator do any other thing, but to notice that to the developers???

Thanks in advance for your time.

Luis
Touching that is DANGEROUS
2 REPLIES 2
Robin Wakefield
Honored Contributor
Solution

Re: Zombie & defunct processes

Hi Luis,

Notice the difference:

lx3p1-3 # ps -flp 21836
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME COMD
1 Z root 21836 676 1 178 20 9bb9580 0 - Jan 17 ? 0:00
lx3p1-4
# ps -fp 21836
UID PID PPID C STIME TTY TIME COMMAND
root 21836 676 1 Jan 17 ? 0:00

You just need to add the "l" switch to see that defunct=zombie.

Basically, when a child process dies, its memory is returned to the OS, but its entry in the process table isn't freed. This lets the parent check the exit status of its child processes. Processes that have died but haven't been removed from the process table are zombies. So, yes, try and can get the code sorted that is causing this.

Rgds, Robin
Luis Miguel Parra Chica
Occasional Advisor

Re: Zombie & defunct processes

Thanks Robin,

I wasn't sure about all that. Now, i notice that the only problem is to look for the cause in the code; and take care about the number of defunct processes to avoid full up the kernel process table.

Luis
Touching that is DANGEROUS