title: why serial run is faster parallel openmp
body: <p>I have a genetic code and I want parallel it on 12 cores, first part is a loop that I want to parallel it, but after parallel and run, I see serial code is faster than parallel code, please tell me where i am wrong. Is there a way that the openmp faster than serrial?</p>
  
  <pre><code>int main() {
  
  srand(time(0));
  srand(rand() % 10000007);
  G.vertex_degrees();
  int step = 0, n_pop = 100;
  
  G.initial_population(n_pop);//parallel shod
  G.full_random_array();//movazi shod
  clock_t start = clock();
  int i = 0,tid,nthreads;
  #pragma omp parallel for 
  for (i = 0; i &lt; n_pop; i++) {
      G.Chromosome_Repairing_Method(i);
      G.Fitness(i);
  }
  //cout &lt;&lt; "MC Size :" &lt;&lt; G.current_Bc_size &lt;&lt; " with  Time (precise) = " &lt;&lt; ((double)(clock() - start)) / CLOCKS_PER_SEC &lt;&lt; "found it" &lt;&lt; endl;
  omp_set_num_threads(4);
  </code></pre>
  
  <hr>
  
  <p>G is an object of genetic algorithm and 
  G.Chromosome_Repairing_Method(i);
  is a function that repair chromosome
  and G.Fitness(i);
  is a function that calculate fitness of each chromosome</p>