How to kill zombie process in Linux environment __linux

Source: Internet
Author: User

When we look at host performance using the top command, we see a zombie keyword in the second row that represents the meaning of the zombie process.

Zombie Process: When a process exits, it sends a SIGCHLD signal to the parent process, always ignoring the SIGCHLD signal by default, at which point the process state remains in memory until the parent process collects state information using the wait function. To empty the information. Wait for a child process to terminate the run is called the Recycle process.       When the parent process forgets to wait for the aborted child process with the waiting () function, the child process enters a state without a parent, at which point the child process is a zombie process. When you use the PS command to observe the execution state of a process, you see that the status bar for these processes is defunct. The zombie process is a long dead process, but still occupies a position (slot) in the Process table (processs table).

But if the process's parent process has ended, the process will not become a zombie process. Because at the end of each process, the system scans all processes running in the current system to see if any process is a child of the process that is just finished, and if so, the Init process takes over and becomes his parent process, ensuring that each process has a parent process. The init process will automatically wait for its child processes, so all processes that are taken over by Init will not become zombie processes.

tasks:337 Total, 1 running, 327 sleeping, 0 stopped, 9 zombie Cpu (s): 0.0%us, 0.0%sy, 0.0%ni, 54.3%id, 45.7%wa,      0.0%hi, 0.0%si, 0.0%st mem:64417m Total, 42611M used, 21806M free, 10924M buffers swap:32764m Total,                                                                                       
 684M used, 32080M free, 28841M cached PID USER PR NI virt RES SHR S%cpu%mem time+ COMMAND  9563 Root 20 0 9040 1312                                                                                           
820 R 0 0.0 0:00.19 Top                                                                                  
    15216 Root 0 0 0 0 S 0 0.0 5:45.61 kworker/22:1                                                                                          
    1 root 0 10528 724 692 S 0 0.0 2:47.29 Init  2 Root 0 0 0 0 S 0  0.0 0:16.94 Kthreadd                                                                                    
    3 root 20 0 0 0                                                                                   
    0 S 0 0.0 9:13.20 ksoftirqd/0                                                                                   
    6 root RT 0 0 0 0 S 0 0.0 94846:34 migration/0                                                                                    
    7 Root RT 0 0 0 0 S 0 0.0 28:43.60 watchdog/0 8 root RT 0 0 0 0 S 0 0.      0 94692:52 MIGRATION/1 Root                                                                                   
   0 0 0 0 S 0 0.0 10:14.96 KSOFTIRQD/1                                                    Root RT 0 0 0 0 S 0 0.0 28:04.19 WATCHDOG/1                                
   Root RT 0 0 0 0 S 0 0.0 97616:33 MIGRATION/2   Root 0 0 0 0 S 0 0.0 8:06.82 KSOFTIRQD/2 Root R                                                                                    
   T 0 0 0 0 S 0 0.0 29:00.53 WATCHDOG/2 Root RT 0 0 0 0 S 0 0.0 78911:26 MIGRATION/3


To view zombie processes in the System state: Ps-ef | The defunct of the grep defunct behind the angle brackets are all zombie processes. When looking at the zombie process, the third column is the PID of the parent process, and to end the zombie process, just kill the parent process. or use: PS aux | Grep-w ' Z ', where the state is Z, represents the zombie process.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.