title: efficient approach in using c++ thread/ boost thread
body: <p>I have a pseudo code that requires parallelization:</p>
  
  <pre><code>int thread_count=8;
  for(int i=1;i&lt;100000;i++)
  {
  do_work(i,record);
  }
  </code></pre>
  
  <p>do_work function will work based on i and write outputs to record. Now, I would like to convert this serialized implementation into a multithreading implementation; </p>
  
  <p>I know that I could do something like</p>
  
  <pre><code>int thread_count=8;
  for(int i=1;i&lt;100000;i++)
  {
  boost::thread t1(do_work,i,std::ref(record));
  }
  </code></pre>
  
  <p>But this will create thousands of threads which will harm performance. I believe the problem posted should be the most natural form that requires multi_threading and I would like to know what is the standard c++ practice to solve this problem... Thank you.</p>