title: How to use clone() to make parent process and child process run at the same time?
body: <p>I'm new to linux. I want to make child process and parent process at the same time. But I have failed. Here is my code. Can anybody help me?</p>
  
  <pre><code>#define _GNU_SOURCE
  #include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sched.h&gt;
  #include &lt;signal.h&gt;
  #define FIBER_STACK 8192
  
  void * stack;
  int do_something(){
      int a = 0;
      while (a&lt;10){
          printf("pid : %d, a = %d\n", getpid(), a++);
      }
      exit(1);
  }
  int main() {
      void * stack;
      stack = malloc(FIBER_STACK);
      if(!stack) {
          printf("The stack failed\n");
          exit(0);
      }
  
      int a = 0;
      if (c == 0)
          clone(&amp;do_something, (char *)stack + FIBER_STACK, CLONE_VM|CLONE_VFORK, 0);
      while (a&lt;10){
          printf("pid : %d, a = %d\n", getpid(), a++);
      }
  
      free(stack);
      exit(1);
  }
  </code></pre>
  
  <p>I want them run in the same time, but the parent process wait until child process has finished.</p>