Linux Process status D and Z processing-Linux general technology-Linux programming and kernel information. The following is a detailed description. I have been living in a Linux environment for a long time, and gradually I have a sense of environmental protection. For example, we will write "Wukong" in the logon prompt. I told you not to litter. It is wrong to litter. Why did you throw the stick before I finish talking? The baby box is a treasure. If it is thrown, it will pollute the environment. What if it hits the children? Even if you don't hit the kids, it's not good if you hit the grass... "; put an empty file named" consciously protecting the environment, do not stack garbage "in the user's default directory, and set it as unchangeable with chattr + I; immediately scan the/tmp directory when you see the spam file, and then send a broadcast to notify the spam maker to claim the/tmp file, and warn the spam maker not to take it as an example... we know that the cleanliness of the system environment helps system administrators maintain a good mood, clear thinking, and stable working status.
There is a type of garbage, but it is not so easy to clean, that is, the common state is D (Uninterruptible sleep), and the garbage process in the status of Z (Zombie. These spam processes are either seeking and not willing, waiting for resources (D) Like a grievance, or being stiff and not dead, waiting for the superdegree (Z) Like a grievance ), they are stuck in the CPU run_queue, and the international friends who have never seen my previous blog think that there is another major event of complaints. What should I do? Shot! Kill-9! You are not leaving. However, these two types of spam processes are pervasive. No matter which method they are used, they cannot be killed. Helpless, so we had to reboot, like killing the bird flu, all indiscriminately!
Wukong, we operate and maintain a 24x7 system that serves external customers around the clock. How can we reboot without moving? Our assessment indicators are FOUR 9 (99.99%, and the unplanned downtime cannot exceed 52 minutes and 34 seconds), not four 8 S. If you encounter something, reboot, do you want availability? Besides, now the society has begun to go to harmony. We should try our best to adopt compassionate means for the two spam processes D and Z to solve their difficulties and create conditions, if the problem can be solved, the problem is solved by burning paper to eliminate the past. The specific problem should be analyzed and solved in detail. Killing innocent people will only lead to a causal cycle of mutual grievance.
The poor monk came back to answer the question. I/O resources are not satisfied, which leads to waiting. In the kernel source code fs/proc/array. in c, the text is defined as "D (disk sleep)",/* 2 */"(from this we can see that D was the Disk's first letter ), corresponds to include/linux/sched. "# define TASK_UNINTERRUPTIBLE 2" in h ". For example, if the NFS server is disabled and the umount directory is not in place, running df on the NFS client will hold the entire logon session, pressing Ctrl + C or Ctrl + Z does not help. Disconnect and log on again. Execute ps axf and you will see that the status bit of the df process has changed to D. kill-9 cannot be killed. The correct solution is to immediately restore the NFS server and provide services again. The suspended df process has discovered the resources it is waiting for. Then, the task is completed and automatically disappears. If the NFS server cannot restore the service, delete the NFS mount entry in/etc/mtab before reboot to avoid waiting for resources again when the reboot process routinely calls netfs stop, the system is suspended during restart.
The reason why Zombie cannot be killed is that Zombie is dead. How can it be called Zombie? The soul is not scattered, and it is natural that there is no solution before life. In UNIX/Linux, each Process has a Parent Process named PID (Process ID). Correspondingly, the Parent Process number is called PPID (Parent PID ). When a process dies, it automatically closes opened files, discards occupied memory, swap space, and other system resources, returns an exit value to its parent process, and reports a dead message. If the program has a bug, the problem will occur in this last step. My son said that I was dead, but I didn't hear it. I didn't immediately accept it, so my son became a zombie. The method of eliminating botnets in UNIX/Linux is cool. Execute ps axjf to find the parent process Number of the zombie process (PPID, first column), and first kill its parent, then, the process tianzi init (its PID is 1, PPID is 0) together to clean up the Parent and Child botnets, Super Death, happy. Note: Sub-processes become botnets only get in the way of sight. If the parent process of a botnet has an active task, you must never rush to death.
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