title: Parallelizing a for loop in C
body: <p>I have a for loop in my C code as follows:</p>
  
  <pre><code>for(i=0; i&lt;100000; i++){
  
      a[i] = simulate(); //  simulate() function simulates some system
  
  }
  </code></pre>
  
  <p>We see that computation of each iteration is independent from others (the order of elements in <code>a[]</code> is not important to me). I want to parallelize the computation of this for loop using multi-threading. I am not exactly aware of how to do this in C? I have a 8 processor machine, so I can run 8 threads parallely.</p>