title: Multicore + Hyperthreading - how are threads distributed?
body: <p>I was reading a review of the new Intel Atom 330, where they noted that Task Manager shows 4 cores - two physical cores, plus two more simulated by Hyperthreading.</p>
  
  <p>Suppose you have a program with two threads. Suppose also that these are the only threads doing any work on the PC, everything else is idle. What is the probability that the OS will put both threads on the same core? This has huge implications for program throughput.</p>
  
  <p>If the answer is anything other than 0%, are there any mitigation strategies other than creating more threads?</p>
  
  <p>I expect there will be different answers for Windows, Linux, and Mac OS X.
  <hr>
  Using <a href="https://stackoverflow.com/questions/360307/multicore-hyperthreading-how-are-threads-distributed#360326">sk's answer</a> as Google fodder, then following the links, I found the <a href="http://msdn.microsoft.com/en-us/library/ms683194(VS.85).aspx" rel="nofollow noreferrer">GetLogicalProcessorInformation</a> function in Windows. It speaks of "logical processors that share resources. An example of this type of resource sharing would be hyperthreading scenarios." This implies that <a href="https://stackoverflow.com/questions/360307/multicore-hyperthreading-how-are-threads-distributed#360385">jalf</a> is correct, but it's not quite a definitive answer. </p>