title: Process in Linux
body: <p>I have an exercise in linux. When running this code.The result always executes the parent process before the child process. So I want to ask, is there ever a time when a child process prints out before a parent process?</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  
  int main(int argc, char *argv[]) {
      printf(&quot;hello world (pid:%d)\n&quot;, (int) getpid());
      int rc = fork();
      if (rc &lt; 0) {
          fprintf(stderr, &quot;fork failed\n&quot;);
          exit(1);
      } else if (rc == 0) {
          printf(&quot;hello, I am child (pid:%d)\n&quot;, (int) getpid());
      } else {
          printf(&quot;hello, I am parent of %d (pid:%d)\n&quot;,
          rc, (int) getpid());
      }
      return 0;
  }
  </code></pre>