Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- #include <sys/types.h>
- int main()
- {
- int i;
- fork();
- fork();
- for(i=0;i<10;i++) {
- printf("pid: %d, %d\n", getpid(), i);
- fflush(NULL);
- sleep(1);
- }
- wait();
- fork();
- fork();
- for(i=0;i<10;i++) {
- printf("2 pid: %d, %d\n", getpid(), i);
- fflush(NULL);
- sleep(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment