Table of Contents
The following sections discuss the relevant interfaces provided by specific systems.
The GetSystemInfo function can be used to retrieve the number of processors on the system, the list of active processors and the memory page size.
Windows Server 2003 introduced NUMA support. System topology information is provided by the GetLogicalProcessorInformation, GetNumaHighestNodeNumber, GetNumaNodeProcessorMask, GetNumaProcessorNode and GetNumaAvailableMemoryNode functions. The current processor can be determined using the GetCurrentProcessorNumber function. The provided topology information can also include information about SMT (Hyperthreaded) logical processors.
Starting with Windows NT 4.0, support was introduced for a thread to have a preferred processor using the SetThreadIdealProcessor function. A thread's current ideal processor is stored in the thread's KTHREAD structure ([NTIFS]).
All systems starting with Windows NT 3.5 (and Windows 95) support thread scope binding using the SetThreadAffinityMask function. Additionally, these systems support process scope binding in the form of the GetProcessAffinityMask function. The characteristics of these functions differ slightly on the Windows 95 family of operating systems as these systems do not include multi-processor support.
Windows NT 4.0 and higher systems support provide for the manipulation of the process affinity mask using the SetProcessAffinityMask function. The current thread affinity mask can be queried on Windows 2000, Windows XP and Windows Server 2003 systems using the undocumented thread information class ThreadBasicInformation with the NtQueryInformationThread function to get a copy of the thread's THREAD_BASIC_INFORMATION structure ([NTDLL]).