如何解决示例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 举报,一经查实,本站将立刻删除。