title: Why AsParallel().ForAll does not seem to fully take advantage of the cpu usage for my operations?
body: <p>I have some code which attempts to execute an operation in parallel.</p>
  
  <p>The code is basically </p>
  
  <pre><code>    items
        .AsParallel()
        .ForAll(item =&gt;
        {
            DoWork(item);
        });
  </code></pre>
  
  <p>Items is a list of 2500 things to process. DoWork() is a 100% CPU calculation with no IO at all. It takes about 1 second however it can vary to some degree.</p>
  
  <p>The problem I am seeing is all cores are being used however they are barely being used. I was thinking it was something to do with the work itself so I tried code like the following and got the same results.</p>
  
  <pre><code>    items
        .Batches(10)
        .AsParallel()
        .ForAll(batch =&gt;
        {
            foreach(var item in batch)
            {
              DoWork(item);
            }
        });
  </code></pre>
  
  <p>I want the utilization to be somewhere near 80% however for the life of me I can't get it there. Not sure what to do.</p>
  
  <p>I have tried Parallel.ForEach with no luck. Tried .WithDegreeOfParallelism(Environment.ProcessorCount * 2) with no luck. </p>
  
  <p>Not sure what to try next.</p>
  
  <p><a href="https://i.stack.imgur.com/WZ2UR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WZ2UR.png" alt="CPU utilization"></a></p>