title: Create multiple child processes and run execvp
body: <p>I have a function in <code>C</code> which creates a child process and makes it run <code>execvp</code>.</p>
  
  <pre><code>int Execute(char **arg)
  {
      pid_t pid;
      int status;
  
      if ((pid=fork()) == 0)
      {
  
          execvp(arg[0],arg);
  
          perror("Execvp error");
          exit(1);
      }
  
      else if (pid &gt; 0)
      {
          waitpid(pid, &amp;status, 0);
      }
      else
      {
          perror("Fork error");
          exit(2);
      }
  }
  </code></pre>
  
  <p>Now I want to alter the function to actually run <code>execvp</code> several times (for example 5), and make the parent process wait for all the children to finish. Tried wrapping it all in <code>for</code> loop, but <code>execvp</code> gets executed just once. I know that basically <code>execvp</code> 'replaces' the current program code, but have no idea whether the iteration does not go on.</p>
  
  <p>Thank you for your help!</p>