Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Physical Processor Count ?

mrshanbh
Beginner
595 Views
Hi,
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 ;
DWORDSystemAffinityMask ;
GetProcessAffinityMask (
GetCurrentProcess(),
& 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 ?
Thanks,
-mithun.
0 Kudos
2 Replies
Shuo_L_Intel
Employee
595 Views
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.
-sli
0 Kudos
mrshanbh
Beginner
595 Views
Sli,
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 -
Regards,
Mithun Shanbhag.
0 Kudos
Reply