title: doParallel in R - Improvement in speed but CPU is not always utilised to 90%-100%
body: <p>I am trying to run many linear regressions and diagnostics over them and to speed things up I am using the <strong><em>doParallel</em></strong> package in the R programming language.</p>
  
  <p>I have come across though an interesting issue. Although I have seen performance improvement -as expected- the <strong>usage of the CPU is not consistent</strong>.</p>
  
  <p>For example, if I do a run of my code, CPU utilization may be <strong>30-40%</strong> for all cores.</p>
  
  <p>If I run again my code, it is possible that CPU utilization goes up to <strong>90%</strong> without me changing anything in the meantime.</p>
  
  <p>In both cases, I am not running anything else on the same time.</p>
  
  <p>Is there an explanation why the cores would be used 30% one time and 90% another time without me changing anything?</p>
  
  <p>I am running Windows XP, 4GB or RAM, and have an Inter(R) Xeon(R) CPU X5650 @ 3.67GHz.</p>
  
  <p>My code looks something like:</p>
  
  <pre><code>results &lt;- foreach(i=seq(1:regressions), .combine='rbind', .export=c('lmResults','lmCSig', 'lmCVar')) %dopar%
  {model &lt;- lm(as.formula(as.character(dat[i])), data=df) lmResults(model)     }
  </code></pre>