Wait function
pid_t Wait (int *status);//function prototype
Header Files <sys/types.h>, <sys/wait.h>
Once the process has called wait, it blocks itself immediately, and the wait automatically parses whether a child process of the current process has exited, and if it finds such a child process that has become a zombie, wait collects information about the child process and destroys it and returns it completely; Wait will always be stuck here until one appears.
A signal from the sigchldsigchld,linux.
When a process terminates or stops, the SIGCHLD signal is sent to its parent process. The system ignores this signal by default. This signal should be captured if the parent process wishes to be informed of this state of its child processes. The wait function is typically called in the capture function of the signal to obtain the process ID and its terminating state.
After the parent process dies, all its child processes are passed on to the Init process, and the INIT process becomes a new process for that zombie process, and the INIT process periodically calls the wait system call to clear its zombie child.
You cannot use kill to pick up the SIGKILL signal. This command kills the zombie process as if it were a normal process, because the zombie process is a dead process and it can no longer receive any signals. In fact, if there are not many zombie processes in the system, we do not need to eliminate them, and a few zombie processes do not have any effect on the performance of the system.
Linux Zombie Process