[Warm, new] process control of UNIX environment programming

xiaoxiao2021-03-06  74

Prerequisites: When a process is normally or an abnormality, the kernel sends a SIGCHLD signal to its parent process.

1) The parent process terminates before the child process, the child process adopts the init process (the process ID is 1);

2) The child process is terminated before the parent process, but its parent process has not been processed back (information about the termination sub-process, releases the resource it occupies), is in the "zombie" state.

3) The parent process can get the termination status of the child process by calling Wait () and WaitPID ().

4) As long as there is a child process termination, the init process calls a wait () function to get its termination.

5) Wait () causes its caller to block; waitpid () will not;

About the fork function:

The child process gets a parent process data space, a replica of the stack and stack, that is, the child has completely copied a copy.

About Copy-On-Write Technology:

The storage rights of the area that need to be copied are "read only", only one copy is made only when these areas need to modify these areas.

转载请注明原文地址:https://www.9cbs.com/read-121420.html

New Post(0)