title: Threads vs Processes in .NET
body: <p>I have a long-running process that reads large files and writes summary files. To speed things up, I'm processing multiple files simultaneously using regular old threads:</p>
  
  <pre><code>ThreadStart ts = new ThreadStart(Work);
  Thread t = new Thread(ts);
  t.Start();
  </code></pre>
  
  <p>What I've found is that even with separate threads reading separate files and no locking between them and using 4 threads on a 24-core box, I can't even get up to 10% on the CPU or 10% on disk I/O. If I use more threads in my app, it seems to run even more slowly.</p>
  
  <p>I'd guess I'm doing something wrong, but where it gets curious is that if I start the whole exe a second and third time, then it actually processes files two and three times faster. My question is, why can't I get 12 threads in my one app to process data and tax the machine as well as 4 threads in 3 instances of my app?</p>
  
  <p>I've profiled the app and the most time-intensive and frequently called functions are all string processing calls. </p>