"Gossip" amusing zombie process and process status D

Source: Internet
Author: User


long-term life in the Linux environment, gradually there is a sense of environmental awareness. For example, we will write in the login prompt " goku, I told you not to throw things, littering is not right." Why did you throw the stick away after I didn't say anything? Moonlight Treasure Box is a treasure, littering it will pollute the environment, if you hit the children? Even if not hit the children, hit the flower is not good... " In the user's default directory, put a " consciously protect the environment do not stack rubbish " empty file, and chattr +i set as non-modifiable, see the junk file immediately sweep into the/tmp directory, and then broadcast to notify the garbage maker to go to/TMP to claim, and warn him not to be a precedent ... We know that the cleanliness of the system environment is conducive to the system administrator to maintain a good mood, clear thinking and stable working condition.

One kind of rubbish is not so easy to clean, that is our common state is D (uninterruptible sleep) , and the status of Z (Zombie) garbage process. These garbage processes are either begging or not, like a disgruntled woman waiting for resources (D), or stiff and immortal, waiting for the cross-over (Z) like ghost, they are stuck in the CPU run_queue, the Load Average is old high, Have not seen my previous blog of the International friends also thought here resentment again what big thing. What to do? Shoot! kill-9! Let's see if you go. But the two kinds of garbage process is invulnerable, no matter what kind of marksmanship can not kill them. Helpless, had to reboot, like to destroy the avian flu as indiscriminately all culling!

Goku, we have 24 * 7 All-weather external customer service system, how can reboot? Our assessment index is 4 9 (99.99%, the whole year plan when the machine time must not exceed 52分钟34秒), is not 4 8, you encounter a little thing reboot, also want to be available? Moreover, now the society has started to run harmoniously, we to the D and Z these two kinds of garbage process, also should take the compassion means, can solve its difficulty, creates the condition, solves its actual difficulty, can eliminate its injustice knot, on the chanting burning paper, eliminates its previous life injustice knot, the concrete question should concrete analysis concrete solution, Indiscriminate killing of innocents will only lead to a delight cause-and-effect cycle ... $^#$%#%^@#

I super degree still come back to say the point. resentment D, often because I/O resources are not met, and trigger wait, in the kernel source fs/proc/array.c, its text is defined as "" D (disk sleep),/* 2 * * (so that D is originally the beginning of disk letter), corresponding The "#define Task_uninterruptible 2" in Include/linux/sched.h. For example, when the NFS server is closed, if the relevant directory is not umount in advance, the NFS client executes DF to hang up the entire login session, pressing CTRL + C, CTRL + Z is useless. Disconnect and then log in, perform PS AXF see just the DF process status bit has become D, kill-9 can not kill. The correct way to do this is to restore the NFS server immediately, again to provide services, just suspended DF process found its hard to wait for the resources, then complete the task, automatic extinction. If the NFS server is unable to recover the service, the relevant NFS mount entry in/etc/mtab should be removed before reboot, so that the system restart process hangs if the wait resource is not repeated when the reboot process calls Netfs stop.

Ghost Z why kill, because it is dead, otherwise how to call Zombie (zombie)? Ghost does not disperse, nature is the reason that the knot is not solved. In Unix/linux, each process has a parent process, howl PID (Process ID), and, accordingly, the parent process number is called PPID (parent PID). When the process dies, it automatically closes the open file, discards the system resources that have occupied memory, swap space, and so on, and returns an exit status value to its parent process, reporting the death. If the program has a bug, it will be a problem in this last step. My son said I was dead, but I did not hear, not in time to collect the coffin departures, the son became a zombie. In Unix/linux the means of eliminating zombies is more brutal, perform PS AXJF find the zombie process of the parent process number (PPID, the first column), first kill its father, and then by the process of the Emperor Init (its PID is 1,ppid 0) to clean up the father and son zombies, cross the Wraith, to the birth of bliss. Note that the child process becomes a zombie just an eyesore, not in the way, if the zombie parent process is currently a priority, you must not be rushed to kill it.


PS: If we can be like the Sun Wukong General "Jiangshan, Bylaws Fang Yiqiu", that is how good ~ ~




"Gossip" amusing zombie process and process status D

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.