清单7与清单6相反——即在父进程之前终止的子进程。
Listing 7 shows the opposite of Listing 6 — that is, the child dying before the parent.
它必须与fork命令一起使用,所以父进程和子进程都在运行:pid_t fork (void)。
This must be used along with the fork command so both the parent and child processes are running: pid_t fork (void).
fork会创建一个子进程,与父进程相比只是PID和PPID不同;实际上,资源利用设为0。
Fork creates a child process that differs from the parent process only in its PID and PPID; in fact, the resource utilizations are set to 0.
应用推荐