Not interrupt the process and zombie process

Original please indicate the source: https://www.cnblogs.com/agilestyle/p/11520274.html

 

When iowait increased, the process is likely to get a response because of hardware, but a long time in an uninterruptible state.

Note that iowait not necessarily represent the high I / O performance bottleneck there. Only when the system I / O type of process at runtime, iowait will be high, but in fact, disk read and write far from the degree of performance bottlenecks.

Therefore, when confronted with iowait increased need to use dstat, pidstat and other tools to confirm is not the disk I / O problem, and then find what's causing I / O.

Waiting for I / O processes are generally not interrupt status, so D status with the ps command to find (that is, not interrupt status) process, mostly for suspicious processes.

Ps or the output from the top order, they can be found both in the D state, i.e. not interrupt status (Uninterruptible Sleep).

top and ps are the most commonly used tool to view the status of the process, starting from the top of the output, S column (that is, the Status column) represents the state of the process.

  • R is the abbreviation Running or Runnable, and that the process in the ready queue of the CPU is running or waiting to run.
  • D Disk Sleep is an abbreviation, is the uninterruptible sleep state (Uninterruptible Sleep), the process is generally expressed with hardware interaction, and interaction not allowed to be interrupted by other processes or interruption.
  • Z is an abbreviation Zombie, which represents zombie process, which is in fact the process has ended, but the parent process has not yet recovered its resources (such as process descriptor, PID, etc.).
  • S is an abbreviation for Interruptible Sleep, which is interruptible sleep state, waiting for an event means the process because the system is suspended. When a process of waiting for the event, it will wake up and enter the R state.
  • I Idle is the abbreviation, which is in an idle state, used in uninterruptible sleep kernel threads. Said earlier, due to non-interactive hardware interrupt process is represented by D, but some kernel threads, they may not actually have any load, with Idle precisely in order to distinguish this case. Note that D status process will lead to increased average load, the state of the process I will not.
  • T or t, which is Stopped or Traced abbreviations, that the process is paused or tracking state.
  • X, which is an abbreviation Dead, that the process is dead, so it will not see it in the top or ps command.

 

Not interrupt status

Uninterruptible state, which in fact is the process in order to ensure data consistency and hardware status, and under normal circumstances, can not interrupt status will end in a very short period of time. So, short of an uninterruptible state and the process can generally be ignored.
But if the system or hardware failure has occurred, the process might not be interrupted state remains for a long time, and even lead to a large number of uninterruptible process occurring in the system. At this point, you have to pay attention, the system is not the emergence of I / O and other performance issues.

 

Zombie process

Zombie process, this is a problem multiprocess applications are likely to encounter. Under normal circumstances, when a process creates a child process, it should be called by the system wait () or waitpid () waits for the child process to finish, resource recovery sub-processes; and the child at the end, will be sent to its parent process SIGCHLD signal, so the parent process can also register handlers for SIGCHLD, asynchronous, resource recovery.

If the parent did not do so, or child process is too fast, not enough time to deal with the parent process the child process state, the child had an early exit, and that this time the child will become a zombie process. In other words, the father should have been responsible for his son, from start to finish, as if you do not keep up or will lead to a "problem child" of.

Typically, the zombie process relatively short duration, it will recover after the demise of its resources in the parent process; or when the parent process exits, recovered by the init process will die.
Once the parent process does not deal with the termination of the child process, but also continues to run, then the child would have been in a zombie state. A large number of zombie process process number PID will run out, leading to the new process can not be created, so this situation must be avoided.

 

summary

  • Uninterruptible state, indicating the process is to interact with the hardware, in order to protect the consistency of process data and hardware, the system does not allow other processes or interrupt interrupt this process. Process a long time in an uninterruptible state usually means the system has I / O performance problems.
  • Zombie process, means that the process has exited, but the parent process has not yet recovered resources occupied by child processes. Short zombie state usually do not have to bother, but a long time in a zombie state process, it should be noted, and may have application does not properly handle the child process exits.

 

Reference

https://time.geekbang.org/column/article/71064

https://time.geekbang.org/column/article/71382

 

Guess you like

Origin www.cnblogs.com/agilestyle/p/11520274.html