Physical Processor Count ?

Physical Processor Count ?


I have a very basic query.

I ran the "cpucounter" utility and it shows the following on my hyperthreaded machine -
physical processor count = 1
logical processors per physical processor = 2

Underthe same machine, i run the following Win32 code -

GetSystemInfo ( & SysInfo ) ;
DWORD count = SysInfo.dwNumberOfProcessor ;

The variable 'count' is now = 2.

Does this mean that SysInfo.dwNumberOfProcessor actually represents thelogical processor count instead of thephysical processor count ?

Also consider the following code snippet -

DWORD ProcessAffinityMask ;
DWORDSystemAffinityMask ;
GetProcessAffinityMask (
& ProcessAffinityMask,
& SystemAffinityMask ) ;

The following is observed -

ProcessAffinityMask=00000003 (2 processors)
SystemAffinityMask=00000003 (2 processors)

Again does this mean that the variables 'SystemAffinityMask' and 'ProcessAffinityMask'represent the affinity mask of logical processorsinstead ofphysical processors ?

Can someone clarify my doubts ?



3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Mithun,

Yourguesses are correct in both cases. Processoraffinity Mask is abit array with each bit represent a logical processor.
However, there are twocaveates:1) changingprocessor affinity maskinterferes with the system scheduler's policy thus itshould be used sparingly; 2) affinity mask changes when the number of physical CPU changes and alsothe Hyperthreading turn on or turn off, which means that optimal performance at oneconfiguration might end up mediocre in another one.
Anotherinteresting note isthat asdual core CPUs come out in future, Microsoftgoto redefine SYSTEM_INFO structure to accommodate another class of processors.



Thanks for the reply.

Windows Server 2003 already supports a API call 'GetLogicalProcessorInformation ( )', that can retrive information about logical processors on hyperthreaded processors.

Unfortunately this function is not supported under Windows XP or earlier editions. Too bad.

You can look it up on msdn -

Mithun Shanbhag.

Leave a Comment

Please sign in to add a comment. Not a member? Join today