Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I open Task Manager I see 8 CPUs in the CPU Graph, since I have a Core i7 with 4 Cores + HyperThreading (running on Win7 x64).

When I set Process affinity I get CPU 0 to CPU 7 listed.

How can I know which CPUs are real cores and which are HT Cores?

I heard that 0/2/4/6 are the real cores and thus the first, third, fifth and seventh CPU graph are the real ones.

Is that true?

share|improve this question
    
welcome to the ranks of the StackAthletes! –  Dennis Williamson Nov 16 '10 at 1:42
add comment

2 Answers

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. :-)

share|improve this answer
1  
It looks like SIV can show you how Windows enumerates your CPUs. See this screenshot for an example. –  afrazier Dec 8 '10 at 16:51
add comment

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.

share|improve this answer
    
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 Stum Nov 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... –  AndrejaKo Nov 15 '10 at 22:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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