0

So, I have been trying to google for this answer, but I cannot find a direct technical answer to the question. (Or if it did, it was in a confusing way)

So, say you have a program/game that uses 2 threads, and only 2 threads. With a quad-core CPU and hyper threading on, will it know to still use two PHYSICAL cores instead of just 2 threads, using 50% of the cpu instead of 25% of it? Does Hyper-threading every cause problems of this type, artificially using half of what it really could/should do? How does Windows know how to handle all of this?

Thanks! Sorry if the way I asked the question was odd, just trying to be clear over concise.

  • 1
    You created an account called ConfusedHyperThreader? :D – ADTC Dec 19 '13 at 8:22
  • 1
    It gave me an option to sign up as an anonymous guest, and then it asked for a name... so I gave it one lol – ConfusedHyperThreader Dec 20 '13 at 0:02
  • Someone knows the answer to this... nobody? – ConfusedHyperThreader Dec 22 '13 at 8:56
  • Sorry that nobody has an answer yet. Maybe you can expand your question with how far you've gone, what you've learned so far, and what exactly isn't clear. I Googled a bit, but I'm out of luck too :) – ADTC Dec 22 '13 at 12:22
  • I don't have a source but I believe Vista and up are "hyperthreading aware" and know the difference between real and hyperthreaded cores. – LawrenceC Oct 19 '14 at 2:17
1

Yes, it does what you want. Windows knows which logical processor is in which core. It will use only one "logical processor" per core until you have more threads that want to run at the same time than you have cores.

("Logical processor" is a name Windows uses internally for "something that can run a thread." If you don't have HT turned on there is one LP per core. If you have HT turned on there are two LPs per core. This allows us to always simply talk about "logical processors" rather than having to constantly qualify things.)

The exact algorithm for picking "where to run a thread" is described in Windows Internals by Solomon, Russinovich, and Ionescu. It is a lengthy description, including many "edge cases" such as parked cores, NUMA machines (those with two or more physical CPU packages each with its own bank of RAM), etc.

But, yes: Windows tries to keep one LP in each core idle, until there are more threads that want to run than cores.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.