- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page