Created
February 23, 2014 03:45
-
-
Save beakr/9166560 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
int pid; | |
pid = fork(); | |
if(pid > 1) { | |
printf("I AM THE PARENT PROCESS\n"); | |
} else if(pid == 0) { | |
printf("I AM THE CHILD PROCESS\n"); | |
pid = fork(); | |
if(pid == 0) | |
{ | |
printf("I AM THE CHILD PROCESS\n"); | |
} else if(pid > 0) | |
{ | |
pid = fork(); | |
if(pid == 0) | |
{ | |
printf("I AM THE CHILD PROCESS\n"); | |
} | |
} | |
} else | |
{ | |
printf("couldn't fork"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment