Linux: Terminating a Zombie Process in Linux Environments

Resumen: What is a Zombie Process, how to find it, and how to kill or terminate it.

Este artículo se aplica a Este artículo no se aplica a Este artículo no está vinculado a ningún producto específico. No se identifican todas las versiones del producto en este artículo.

Instrucciones

What is a Zombie Process:
It is a process that ended but not all of it is Immediately removed from the memory as its process descriptor stays in memory.

What should be the normal Behavior of a Process:
When a process ends, the process's status becomes EXIT_ZOMBIE and the process's parent is notified that its child process has died with the SIGCHLD signal.

The parent process is then supposed to run the wait() for the system call to read the dead process's exit status and other information. After wait() is called, the zombie process is removed from memory. This happens quickly, so you do not see zombie processes accumulating on your system. But in cases where we see several zombie processes accumulating, this is a situation where the program code is not efficient.

How to Find a Zombie Processes:
Running the command top
results from Top command

Running the command ps -ef | grep defunct
result of defunct command

How to Terminate Accumulating Zombie Processes:
Most of the time, the zombie processes have the same parent process ID.

There are two methods to remove the process:
  • Send the SIGCHLD signal to the parent process.
This signal tells the parent process to run the wait() system call and clean up its zombie children:
kill -s SIGCHLD <PPID>
Example:
kill -s SIGCHLD 2201
  • Kill the zombie parent process
kill -9 <PPID>
Example:
kill -9 2201

Productos afectados

SUSE Linux Enterprise Server 12, Red Hat Enterprise Linux Version 7, Red Hat Enterprise Linux Version 9, Red Hat Enterprise Linux Version 8, SUSE Linux Enterprise Server 15, Ubuntu Server LTS
Propiedades del artículo
Número del artículo: 000019108
Tipo de artículo: How To
Última modificación: 12 abr 2025
Versión:  4
Encuentre respuestas a sus preguntas de otros usuarios de Dell
Servicios de soporte
Compruebe si el dispositivo está cubierto por los servicios de soporte.