【发布时间】:2022-10-02 06:31:05
【问题描述】:
你能给出一个解释和答案。我在识别这些系统调用创建的正确进程数时遇到了一些问题。
我认为将创建 8 个进程。
#include <stdio.h>
main()
{
printf(\"Here comes the date. \\n\");
printf(\"Here it is. \\n\");
fork();
fork();
fork();
execl(\"/bin/date\", \"date\", 0); //Line A
printf(\"That was the date. \\n\"); //Line B
printf(\"Program will exit now. \\n\"); //Line C
}
-
注意最后两个
print()函数调用将不会被执行(调用),除非execl()调用失败。
标签: c process fork parent-child