• Home
  • Disclaimer
  • Contact
  • Archives
  • About
  • Subscribe
  • Support
  • Advertise

Kernel Talks

Unix, Linux, & Cloud!

  • How-to guides
    • Howto
    • Disk management
    • Configurations
    • Troubleshooting
  • OS
    • HPUX
    • Linux
  • Miscellaneous
    • Software & Tools
    • Cloud Services
    • System services
    • Virtualization
  • Certification Preparations
    • AWS Certified Solutions Architect – Associate
    • AWS Certified Solutions Architect – Professional
    • AWS Certified SysOps Administrator – Associate
    • AWS Certified Cloud Practitioner
    • Certified Kubernetes Administrator
    • Hashicorp Certified Terraform Associate
    • Oracle Cloud Infrastructure Foundations 2020 – Associate
  • Tips & Tricks
  • Linux commands
You are here: Home / Howto

Everything you need to know about the zombie process

Published: February 10, 2017 | Modified: June 2, 2020



Understand what is zombie process in Linux Unix, how the process goes to a zombie state, how to handle the zombie process, what is the impact of zombie processes.

In very lame terms, the Zombie process is a process that is present in the process table even if it’s already dead! The zombie process is also known as a defunct process. To understand how the zombie process gets created let see how to process exiting takes place from memory.

How the zombie gets created

Whenever the process completes its execution, it exits and notifies its parent process that his child has died. At this time, the parent process supposes to execute the WAIT system call which reads dead child process status and other details. Once the wait system call completes, a dead child will be removed from memory. At this point, if the parent process is not coded properly or unable to read this status from a child for some reason then it won’t fork wait system call. This in turn keeps the dead child process in memory & process table.

This whole operation completes very fast. Zombie takes a very tiny amount of memory to live in so a couple of zombies on the server are harmless. Many zombie processes have parent PID as 1 which is the init process. When a child is dead but not cleared from memory and parent process exists then those child zombies will be taken over by init. Init usually runs its child zombie clearance periodically. So its possible those zombies get cleared out in it.


How to check the zombie process

You can list zombie processes on your server with below command :

# ps aux |grep Z
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     16479  0.0  0.0 103304   812 pts/0    S+   10:44   0:00 grep Z
oracle9  14523  0.0  0.0  52367   702 pts/1    Z    09:15   1:00 asldjkeh

In the above output watch out for STAT column. Z indicates the zombie process. Even top command shows a total number of zombie processes on the system. Check highlighted field in yellow :

You can get parent PID of the zombie process using ps or pstree command.


How to kill the zombie process

You simply can’t! Because of its Zombie! It’s already dead! The maximum you can do is to inform its parent process that its child is dead and now you can initiate a wait system call. This can be achieved by sending SIGCHLD a signal to parent PID using below command :

# kill -s SIGCHLD <ppid>

Here, ppid is the parent process id.


Impact of the zombie process on the system

As we already discussed, a couple of zombie processes are harmless. But if they are growing rapidly then there are two areas which may be bottlenecked and your system prone to panic :

  1. Each zombie holds its PID hence rapidly growing zombies can exhaust all available PIDs on the system and then no new process can be forked by the kernel.
  2. Even zombie holds a very tiny amount of memory, huge numbers can make a difference. A large number of zombies can hog a considerable amount of memory contributing to high memory utilization of the machine.

If your system is flooded with zombies that are not being cleared even by init, system reboot can be tried for a quick refresh. Obviously this would be the last resort you should be looking at.

⇠ Previous article
Dynamic Root Disk DRD configuration in HPUX
Next article ⇢
How to open the file in the read-only mode under vi or vim

Related stuff:

  • Create nice text banner in HPUX
  • How to setup domain name in Linux server
  • How to check and test APA in HPUX
  • Run command on multiple linux servers from windows
  • How to change timezone in Linux server (RedHat, CentOS, Ubuntu)
  • How to convert JKS file to KEY file for Apache
  • How to enable repository using subscription-manager in RHEL
  • How to list YUM repositories in RHEL / CentOS
  • How to add Cloundfront CDN in WordPress blog with SSL
  • How to map Linux disk to vmware disk
  • How to move /tmp on a separate disk as a separate mount point
  • Execute command at shutdown and boot in Suse Linux

Filed Under: Howto Tagged With: check zombie processes in linux, defunct process in linux, how to find zombie process, how to kill defunct process, how to kill zombie process, how zombie process gets created, list of zombie processes in linux, what is zombie process in linux

If you like my tutorials and if they helped you in any way, then

  • Consider buying me a cup of coffee via paypal!
  • Subscribe to our newsletter here!
  • Like KernelTalks Facebook page.
  • Follow us on Twitter.
  • Add our RSS feed to your feed reader.

Comments

  1. Justus says

    February 17, 2020 at 1:58 pm

    Great article. You can always ask me to proof read your English before publication. It’s a free service.

    Reply
  2. Nnarol says

    March 11, 2020 at 1:45 pm

    Useful information, but the grammar is absolutely terrible.
    I would consider approaching @Justus about his offer.

    Reply
    • Shrikant Lavhate says

      March 18, 2020 at 7:58 pm

      Oh, I forgot to proofread this one. Most of my old articles are still in the bin for it.

      Reply

Share Your Comments & Feedback: Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get fresh content from KernelTalks

  • Email
  • Facebook
  • RSS
  • Twitter

Get Linux & Unix stuff right into your mailbox. Subscribe now!

* indicates required

This work is licensed under a CC-BY-NC license · Privacy Policy
© Copyright 2016-2023 KernelTalks · All Rights Reserved.
The content is copyrighted to Shrikant Lavhate & can not be reproduced either online or offline without prior permission.