示例if的fork过程

问题描述

void main{}
{
pid_t pid;
pid = fork();  // parent and child
pid = fork();  // -> is this Now child and child or parent and child?
printf{"hello};
pid = fork();  // same question,but this should be like 2^3 processes? so 8 Process right?
if (pid>0);    // here im checking only the parent(=1)? 
{
pid=fork();    // is it right that Now i only fork the parents? my thougt Now is 8 process,and from those 8 are 4 Parents? means 8 new processes? i hope im still right
{ 
else pid=fork  // this would only occure if pid==0? 
}

希望你们能理解我的意图,如果我的思想是正确的,有人可以帮助我吗? 问题是我要创建多少个流程? 谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)