2 Answers
2

Intel originally wanted BIOS implementers to enumerate all physical CPUs first before logical (HT) CPUs. The reason for this was that if an operating system supported fewer CPUs than were available in the system, it would see the physical cores first before seeing the logical cores. This isn't an issue nowadays, but back when it was possible to buy a dual-core Pentium 4 w/ HT, put it into a Windows 2000 Pro system, and only see 2 CPUs no matter what, it was a real concern. I doubt that the implementation would deviate from that. So in your case it's most likely that CPUs 0-3 are the physical cores and CPUs 4-7 are the HT cores.

If you're having problems with your own multi-threaded software not balancing well because of HT, then you'll probably want to limit your thread count to the physical cores only, or work on your algorithms/data structures to be more HT-friendly. GetLogicalProcessorInformation is the API call you need to look at to determine physical vs. logical core count. This page has sample code for determining the # of Physical CPUs.

Making your code more HT-friendly is, well, a whole different ball of wax and not really suited for SuperUser. :-)

Well, the point of HT cores is to have them appear to system as if they were real processors. I'm not 100% certain, but I think that there is no real way to know which are real and which are HT.

Also, if I understand HT correctly, it works by using up free processing power of the real core. If the HT core is executing a demanding process and real core is not, processing power will be used up by HT. Still, this could lead to problems where most demanding processes could be given to real cores and their HT cores and have some real cores running background tasks.

Indeed, for the most part it should be transparent and handled by the Windows Scheduler. However, if a 2-Thread Application is running on a Core and it's HT Core, then that can be a problem. Especially when setting affinity manually. SQL Server is one application that can have some quirks with HT, but I'm having some others (mainly some that I wrote myself :/) that don't balance well.
–
Michael StumNov 15 '10 at 22:39

@Michael Stum I've been thinking about this and I remember that there was a game called Aquanox 2 back in the days when HT was new. It had option to enable or disable HT support. I wonder how they managed to do that...
–
AndrejaKoNov 15 '10 at 22:59