Experimental purposes
By writing a multiple process program, you are proficient in the use of functions such as fork (), exec (), wait (), and Waitpid () to further understand the procedures for multiple process programming in Linux.
Experimental content
The experiment has 3 processes, one of which is the parent process, and the remaining two are the child processes created by the parent process, one of which runs the "ls-l" instruction and the other subprocess quits unexpectedly after 5s is paused. The parent process waits for the end of the first process to be blocked, then waits for the exit of another subprocess in a non-blocking manner, and the parent process returns after the message that the 2nd child process ends.
Experiment steps
The flow chart of the experiment is as follows
Experimental source code
First look at the following code, this program can get the results we want? How many processes will it run?