08-11-2004 01:35 AM
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 -
SYSTEM_INFO SysInfo ;
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 ;
& 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 ?
08-12-2004 07:56 AM
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.
08-12-2004 06:44 PM
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 -