Process scheduling strategy: FIFO, Time slice rotation, general dispatch, batch scheduling, high priority preemptive
The child process has no fixed order with the parent process, and cannot assume that the child process will be executed after the parent process, or that the child process must be executed before the parent process;
Zombie Process
- The child process has ended, but the parent process has not been called to wait for the wait () function
- The child process has been terminated, but has not been properly cleared to become a zombie process
means to clear the child process
- The parent process calls the wait () function to ensure that the child process is cleared
- Even if a child process dies before the parent process calls the wait () function, its exit status can be extracted and then cleared
- Non-purged child processes are automatically adopted by the INIT process
#include <stdlib.h><sys/types.h><unistd.h>int main () { pid_t child_pid; = fork (); if 0) // parent process, speed sleep 60 seconds Sleep (); Else // child process, exiting immediately Exit (0); return 0 ;}
C + + Learning Note 41: Process scheduling