(1) The difference between exit () and _ exit (): _ exit () directly stops the process, clears the memory space used by the Eliminator, and destroys various data structures in the kernel.
Before calling the exit system, the exit () function should check the file opening status, write the content in the File Buffer back to the file, and clear the I/O buffer (this function is recommended)
(2) waitpid
# Include <sys/types. h>
# Include <sys/Wait. H>
Pid_t waitpid (pid_t PID, int * status, int options );
The values of PID are different, with different meanings:
When the PID is greater than 0, only the child process whose process id = PID is waiting, no matter how many other child processes have been launched, as long as the specified child process has not ended, waitpid will keep waiting;
When pid =-1, wait for any sub-process to exit without any restrictions. At this time, waitpid and wait work the same way;
When pid = 0, wait for any sub-process in the same process group. If the sub-process has been added to another process group, waitpid will not ignore it;
PID <-1, wait for any sub-process in a specified process group, the ID of this process group is equal to the absolute value of PID