A zombie process is a dead process, but it still occupies a slot in the processstable ). Because the capacity of the Progress table is limited, the defunct process not only occupies the system memory resources, but also affects the system performance. If the number is too large, it will also lead to system paralysis. The child process is created by the parent process.
The "zombie" process is a long-dead process, but it still occupies a slot in the processs table ). Because the capacity of the input table is limited, defuNcT processes not only occupy system memory resources, but also affect system performance. If the number of t processes is too large, it will also lead to system paralysis.
A child process is created by a parent process. After a parent program is executed and exited, the child process exits directly, regardless of whether the child process is a zombie or not, because the parent process is dead. So this will not cause much harm? If you think so, it's wrong.CommandWhen you observe the execution status of a process, you can see that the status bar of some processes is defunct. This is the so-called "zombie" process. The "zombie" process is a long-dead process, but it still occupies a slot in the processs table ). Because the capacity of the Process Table is limited, the defunct process not only occupies the system memory resources, but also affects the system performance, for details, see the following code:
/*********************************** Unlimited sub-Process Creation **************************************** ****/
# Include
# Include
Main ()
{
For (;)/* Create an endless loop */
Fork ();/* start to create a sub-process */
}
/*************************************** **************************************** *************/
If you know C, you will know that for (;) is an endless loop. Then, a program with only two lines of code can instantly crash your linux system, because it does not limit the addition of new sub-processes in the memory, A system allocates the maximum number of processes based on the memory capacity. Once the number of processes running at the same time exceeds the limit, your machine will inevitably crash.
I have used two users for testing. One is a normal user and the other is a Root user. The test result is that "any user who executes this program will let the machine die ". The reason is that the default Linux system does not limit the maximum process used by common users. Therefore, this poses a major threat to the system. How can we avoid the system being dragged to death due to the illegal execution of too many resources or processes by common users.
Restrict normal users:
Step 2: first go to the Linux terminal and use vi to edit the/etc/security/limits. conf file. Add the following to it:
* Hard core 0
* Hard rss 5000
* Hard nproc 20
* Indicates all users except Root. (* hard core 0) indicates that core is disabled.FileS "core 0" (* hard rss 5000) indicates that the memory usage is limited to 5 MB "rss 5000", and (* hard nproc 20) indicates that the number of processes is limited to "nproc 50". You can configure the memory size based on your system.
Step 2: Use vi to edit the/etc/pam. d/login file, and then add the following line to save and exit.
Session requirEd/Lib/security/pam_limits.so
Now, we have restricted the process and memory usage limit for normal users. After modifying the configuration, you can use Root and normal users to perform tests respectively, the result is of course that normal users will not crash after executing the program we just made.
The security of a system is not dependent on or not patched. Although patching is very important, it is also very important to configure the system.