Saturday 20 September 2014

About DEFUNCT Process


l  defunct processes does not consume any system resources (minimal, negligible) and can be ignored (until number is huge)
l  Defunct processes are created when a child process exits and it's parent does not wait for it
l  Once a child process exits and infroms parent process, parent process should send clean up signal. If parent process does not clean up child process, it turns into defunct process
l  Badly written programs leaks children and creates defunct processes
l  Normally, zombie (defunct) processes are cleaned by INIT process once their parent processes terminates.

Following actions can be taken when defucnt processes are observed

l  Fix the program to avoid defunct processes. This is always preferred way.

l  Restart the parent process. When parent process is stopped, child process becomes ORPHAN and INIT process becomes its parent. Note difference between defunct and orphan process. Defunct process with parent PID 1 are ORPHAN.
l  Reboot system – This will clean up all defunct processes. Please note this does not guarantee that defunct processes  will not be created after reboot

l  Use preap command (see man preap for syntax) to reap the child. Please note this can be dangerous as parent actually may be waiting for CHILD process and expecting to reap child at later date/time. PREAP should be used only if you are sure enough that process is defunct and parent is not waiting/expecting to clean up child process. ORPHAN processes are good candidates for preap use. KILL with signal 9 should be used prior to using preap.

No comments:

Post a Comment