title: Need Advice on Multithreaded Merge Sort
body: <p>Basically, if the number of lists in a merge sort is equal to the number of cores in the computer it will spawn a thread to sort each of the lists. It works currently but the problem that I'm facing is that it's actually taking longer to sort than the normal merge sort. It takes longer because instead of spawning lets say 4 threads at the same time, it's spawning a thread and it goes through its whole process before moving on to calling the next thread. Below is the code that I wrote, it works but again it goes slower because of the problem I stated above. If anyone has any familiarity with using threads in sorting algorithms any feedback would be greatly appreciated. FURTHERMORE, this is not homework, my project for class was to design a normal merge sort, I'm just trying to experiment around with the language and try different things. </p>
  
  <pre><code>void MergeSortThreading(int low, int high, int* source, int* destination, int count)
  {
  if (low == high)
      return;
  int mid = (low + high) / 2;
  int start_1 = low, end_1 = mid, start_2 = (mid + 1), end_2 = high, dest = start_1;
  
  if (pow(2, count) == cores())
  {
      thread* processes = new thread[cores()];
      int j = 1;
      for (int i = 0; i &lt; cores(); i++)
      {
          processes[i] = thread(MergeSortThreading, j, (j + (high)), destination, source, 1000);
          j += (high - 1);
      }
  
      for (int i = 0; i &lt; cores(); i++)
          processes[i].join();
  }
  
  MergeSortThreading(low, mid, destination, source, ++count);
  MergeSortThreading((mid + 1), high, destination, source, 150);
  
  while (start_1 &lt;= end_1 &amp;&amp; start_2 &lt;= end_2)
  {
      if (source[start_1] &gt; source[start_2])
          destination[dest++] = source[start_2++];
      else
          destination[dest++] = source[start_1++];
  }
  
  if (start_1 &gt; end_1)
  {
      for (; start_2 &lt;= end_2; start_2++)
      {
          destination[dest] = source[start_2];
          dest++;
      }
  }
  else
  {
      for (; start_1 &lt;= end_1; start_1++)
      {
          destination[dest] = source[start_1];
          dest++;
      }
  }
  </code></pre>
  
  <p>}</p>