|
发表于 2009-10-22 14:14:34
|
显示全部楼层
1 #include "stdlib.h"
2 #include "stdio.h"
3
4
5 int main(void)
6 {
7 int i;
8 int j;
9
10
11
12 for(i=0;i<10;i++)
13 {
14 j=fork();
15 if(j==0)
16 {printf("This is son process: %d..................................\n",i);return 0;}
17 if(j>0)
18 {
19 printf("This is father process: %d...........\n",i);
20 sleep(1);
21 }
22 }
23
24 return 0;
25 } |
|