【发布时间】:2011-06-17 23:11:44
【问题描述】:
fork() 用于创建子进程...您会看到此调用也出现在子进程中。当他们说'调用 fork 实际上返回两次'时,我不明白这意味着什么。
这是什么意思...
if (fork() == 0)
/* the child process's thread executes here*/
else
/*the parent process's thread executes here*/
上面的代码部分是父母还是孩子。你能用简单的英语解释发生了什么吗?
另外,为什么要使用fork()?它说unix中的所有进程都由这个系统调用运行?你如何fork() 以便其他程序可以运行?您指定程序的名称吗?
【问题讨论】: