Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<sys/types.h>
- #include<unistd.h>
- #include<stdlib.h>
- #include<time.h>
- int main(){
- pid_t ret;
- pid_t rec;
- int i;
- printf("nn P ID :
- %d tPP ID : %d n",getpid(),getppid());
- sleep(1);
- ret= fork();
- srand(time(NULL));
- printf("n PID : %d t PP ID : %dn",getpid(),getppid());
- printf("getpid()=%d ret=%d rec=0n",getpid(),ret,rec);
- printf("n");
- sleep(1);
- rec= fork();
- printf("n PID : %d t PP ID : %dn",getpid(),getppid());
- printf("getpid()=%d ret=%d rec=0n",getpid(),ret,rec);
- printf("n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement