I have a for loop in my C code as follows:

for(i=0; i<100000; i++){

    a[i] = simulate(); //  simulate() function simulates some system

}

We see that computation of each iteration is independent from others (the order of elements in a[] 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.

Edit
Report