1、1.首先,实现方法进程与指定cpu绑定:SetProcessAffinityMask(GetCurrentProcess(),dwMask);

2、2.线程与指定cpu绑定:SetThreadAffinityMask(GetCurrentThread(),dwMask);dwMask为CPU序号的或运算值:1(0001)

3、3.代表只运行在CPU1,2(0010)代表只运行在CPU2,3(0011)代表可以运行在CPU1和CPU2,以此类推。

4、4.设置之前最好判断一下系统有几个CPU:SYSTEM_INFOSystemInfo;GetSystemInfo(&SystemInfo);CPU个数:SystemInfo.dwNumberOfProcessors

5、5.当前启用的CPU序号:SystemInfo.dwActiveProcessorMask,Mask representing the set of processors configured into the system. Bit 0 is processor 0;bit 31 is processor 31.
