title: is Fork() different in Cygwin (on Windows) and Linux
body: <p>I'm using this code in both Linux and in Cygwin (on Windows) and the output order is different and I have no clue why..</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;sys/types.h&gt;
  
  
  
  int main()
  {
          pid_t pid;
  
          /* fork a child process */
          pid = fork();
  
          printf("\n PID1 %d\n",pid);
  
          pid = fork();
  
          printf("\n PID2 %d\n",pid);
  
          return 0;
  }
  </code></pre>
  
  <p>the output in windows is:</p>
  
  <pre><code> PID1 3888
  
   PID1 0
  
  
   PID2 5564
   PID2 7772
  
   PID2 0
  
   PID2 0  
  </code></pre>
  
  <p>but in Linux (and MAC) it looks like</p>
  
  <pre><code>PID1 2486
  
   PID2 2487
  
   PID2 0
  
   PID1 0
  
   PID2 2488
  
   PID2 0
  </code></pre>
  
  <p>My question is PID2 ( PID2 2487) comes before PID1 in Linux but not in Windows (the output behavior is the same every time I run the code)   </p>