title: Concurrent processes in C
body: <p>How can I have 3 processes running in parallel? Is this solution below correct?
  In my solution I put some code to see the time elapsed and I think this is tunning in sequential mode. I need to put pid1, pid2 and pid3 running at the same time.</p>
  
  <pre><code>pid = fork();
  if(pid == 0) {
          //code...
      exit(EXIT_SUCCESS);
  } else if(pid &gt; 0) {
          pid1 = fork();
          if(pid1 == 0) {
                  //pid1 code...
              exit(EXIT_SUCCESS);
      } else if(pid1 &gt; 0) {
              waitpid(pid1, &amp;status, 0);
      } else {
          printf("Fork error %d.\n", errno);
      }
  
      pid2 = fork();
      if(pid2 == 0) {
                  //pid2 code...
          exit(EXIT_SUCCESS);
      } else if(pid2 &gt; 0) {
          waitpid(pid2, &amp;status, 0);
      } else {
          printf("Fork error %d.\n", errno);
      }
  
      pid3 = fork();
      if(pid3 == 0) {
                  //pid3 code...
                  exit(EXIT_SUCCESS);
      } else if(pid3 &gt; 0) {
          waitpid(pid3, &amp;status, 0);
      } else {
              printf("Fork error %d.\n", errno);
      }
          waitpid(pid, &amp;status, 0);
  }
  </code></pre>