• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Kill Zombie (Defunct) Process in Solaris

by admin

What is a Defunct (Zombie) Process

To understand what a defunct process (sometimes known as a zombie process) is, let us take a look at how processes work. We shall look at processes on Solaris as an example. When a program is run within a shell, the shell starts a new process to carry out the work.

A defunct, or Zombie process, is just that, a process information block that is waiting for the parent process to clean it up. While defunct processes do not take up any CPU time, RAM or IO, it does consume a process information block, a limited resource.

The “zombie” name comes from the status entry which should be a “Z”. Since the process has essentially exited, information regarding the name of the program is no longer available, so the “zombie” name is used indicating it’s dead and gone. Here is sample output of ps output showing a defunct process in the kernel’s process table:

# ps -ef | grep defunct
root 12610 1 0 - ? 0:00 <defunct>

Killing defunct Process on Solaris 8 and below

In Solaris 8 and older version of the Operating systems, it is necessary to reboot to clear defunct and/or zombie processes.

Killing Defunct Process on Solaris 9 and higher

In Solaris 9 and higher, the preap command can kill defunct processes. The preap command should be used only in situations in which the administrator or developer has confirmed that defunct processes will not be reaped by the parent process. Otherwise, preap may damage the parent process in unpredictable ways.

# preap 12610
12610: exited with status 0

Conclusion

By design, processes will not completely exit until the parent has picked up their exit status. If there are lots of zombie processes on the system, examine the ps output and see what the parent process ID is. It’s the responsibility of the parent to identify all children who have exited and obtain the status even though the parent doesn’t want to do anything with it.

Once the parent process exits, all of its children are moved to init. The ultimate root of this tree of processes is PID 1 (the init process). If init inherits a zombie process, the process will be “reaped” or removed from the process table as one of the tasks of init is to wait for (and discard) the exit status of zombies.

Note: Under Solaris 9 or later, the preap command may be used to “reap” zombie processes. preap will not reap processes that are currently being traced, or have been in a zombie state for 60 seconds or less; the rationale for this is that the parent may be unable to wait for the zombie at the moment (if the parent is being traced) or may yet wait for the zombie given more time.

Filed Under: Solaris

Some more articles you might also be interested in …

  1. Script to reset the iostat errors counters (hard/soft/trn) without reboot
  2. How to install and configure sudo in solaris 10 (SPARC and x86/x64)
  3. What are Oracle Solaris 11 Installation Methods
  4. A beginners guide to Service Management Facility (SMF) in Solaris
  5. How to allow only specific non-root user(s) to use crontab
  6. How to Backup and Restore ZFS root pool in Solaris 10
  7. Solaris : How to validate that the crash dump was created properly
  8. How to setup a chroot ssh/sftp in Solaris 10
  9. GUDS – A Script for Gathering Solaris Performance Data
  10. How to Enable ssh/sshd Debugging for Solaris

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright