Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/wait.h>
- int main ()
- {
- pid_t pid;
- printf("Moj PID : %d\n",getpid());
- switch(pid = fork()){
- case 0:{
- printf("Jestem procesem potomnym (PID: ) - %d\n", getpid());
- switch(pid = fork()){
- case 0:
- printf("Jestem procesem potomnym potomnym (PID: ) - %d\n", getpid());
- default:
- printf("Jestem procesem potomnym macierzystym (PID: ) - %d\n", getpid());
- }
- }
- default:
- printf("Jestem procesem macierzystym (PID: ) - %d\n", getpid());
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement