Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int i ,childPid;
- printf("\n I am the father and my pid = %d\n", getpid());
- for(i=1;i<=10;i++)
- {
- childPid=fork();
- if(childPid > 0 )
- wait();
- else
- if (childPid == 0 )
- {
- printf("I am child, My PID is: %d I am child number %d\n",getpid(),i);
- exit(0);
- }
- else
- {
- printf("\nfatel error num#ron_yalensky");
- exit(1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment