Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. int main()
  2. {
  3.     pid_t zaklad;
  4.     if ((zaklad = fork()) >=0) //successful fork
  5.     {
  6.         if ((zaklad = fork()) ==0) //child process
  7.         {
  8.             printf("This is child process \n");
  9.         }
  10.         if ((zaklad = fork()) >0)
  11.         {
  12.             printf("This is parent process \n");
  13.         }
  14.  
  15.     }
  16.     else //fork failed
  17.     {
  18.         fprintf (stderr,"fork error\n");
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement