Analysis of suspended animation linux

The so-called suspended animation, is able to ping, but ssh does not go up; also did not respond to any other operations, including the deployment of apache above can not open the page.

As a multitasking operating system, make the system too busy, so busy are ssh Rom, it is not so easy. Especially now that there fd protection mechanism, the number of process protection, maximum memory protection and the like. You can fork a lot of processes, the system will become very slow, but still ssh can even go up; you can allocate a lot of memory, but the memory is more to a certain extent oom killer will kill your process, so ssh can work.

A determination can be suspended animation system into an approach is: 500MB main memory allocation process, and then stop the fork, and sleep (100) inside the child process.

What is the principle? This is a swap, copy on write, allocate on write, acting together oom killer results. When the Lord kept fork process, the system will soon run out of physical memory, and then began to swap; the swap when triggered fork of copy on write property; this time will need to allocate memory for real before the copy on write child process, due to lack of memory, which will trigger the oom killer began to kill the process; when the oom killer to kill the child process, the main process immediately and fork a new child process and lead runs out of memory, triggering oom killer again again; and so death circulation, and oom killer is a high priority of the underlying system kernel threads, are also participating in an endless loop.

At this point the machine can ping, ssh but not up. This is because ping is the underlying processing system, and was not involved in the process of scheduling; sshd to participate in the process of scheduling, but not a high priority oom killer, total lack of scheduling.

Why charge so much effort put the machine Gaosi? Because everyone will encounter case of suspended animation machine. Know how suspended animation is created, it can be the reason for the prevention of suspended animation.
In fact, we recommended nice to sshd process priority to increase. So that when the system memory is tight, can barely landed sshd, enter debug. Then analyze the fault.

Guess you like

Origin www.cnblogs.com/baozexu/p/11415459.html