))==0) { execl("/bin/echo","echo","I am P1",0); } wait(&status); if((p2=fork())==0) { execl("/bin/echo","echo","I am P2",0); } if((p3=fork())==0) { execl("/bin/echo","echo","I am P3",0); } do { pid=wait(&status); if(pid==p2) end_p2=1; if(pid==p3) end_p3=1; }while(end_p3==0); if((p4=fork())==0) { execl("/bin/echo","echo","I am P4",0); } if((p5=fork())==0) { execl("/bin/echo","echo","I am P5",0); } do { pid=wait(&status); if(pid==p4) end_p4=1; if(pid==p5) end_p5=1; }while(end_p4==0||end_p5==0); if((p6=fork())==0) { execl("/bin/echo","echo","I am P6",0); } do { pid=wait(&status); if(pid==p2) end_p2=1; if(pid==p6) end_p6=1; }while(end_p2==0||end_p6==0); if((p7=fork())==0) { execl("/bin/echo","echo","I am P7",0); } wait(&status); exit(1); }[运行结果]I am P1I am P2I am P3I am P4I am P5I am P6I am P7