title: About vfork() system call?
body: <pre><code>#include &lt;stdio.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;sys/wait.h&gt;
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  int main()
  {
     pid_t child_pid = vfork();
  
     if(child_pid &lt; 0)
     {
         printf("vfork() error\n");
         exit(-1);
     }
     if(child_pid != 0)
     {
         printf("Hey I am parent %d\nMy child is %d\n",getpid(),child_pid);
         wait(NULL);
     }
  
     else
     {
         printf("Hey I am child %d\nMy parent is %d\n",getpid(),getppid());
         execl("/bin/echo","echo","hello",NULL);
         exit(0);
     }
     return 0;
  }
  </code></pre>
  
  <p>output:</p>
  
  <pre class="lang-none prettyprint-override"><code> Hey I am child 4
   My parent is 3
   Hey I am parent 3
   My child is 4
   hello
  </code></pre>
  
  <p>My question : Why is "hello" printed after the execution of parent process?
   I have started learning about vfork(). Could anyone please help me with this?</p>