我使用start /AFFINITY [n] [.exe]命令启动具有指定关联的可执行文件。我有一个有8个处理器的系统(1,2,3,4,5,6,7,8)。我想设置这个过程来使用所有的奇数处理器(1,3,5,7)。我不知道如何做到这一点,我想知道是否可以使用start命令。如果没有,是否有一种替代的命令行方法?
start命令的帮助并不特别有用:
AFFINITY Specifies the processor affinity mask as a hexadecimal number.
The process is restricted to running on these processors.
The affinity mask is interpreted differently when /AFFINITY and
/NODE are combined. Specify the affinity mask as if the NUMA
node's processor mask is right shifted to begin at bit zero.
The process is restricted to running on those processors in
common between the specified affinity mask and the NUMA node.
If no processors are in common, the process is restricted to
running on the specified NUMA node.发布于 2011-10-13 20:33:23
亲和力与允许对所有处理器进行粒度控制的己二胺掩模一起工作。注意,最右边的位指定了最低阶的CPU (0) (参见KB 299641)。
对于所讨论的情况,0xAA (10101010)请求您的进程使用处理器1、3、5和7运行,但不使用0、2、4或6。确保在命令行中省略'0x‘。
start /affinity AA app.exe其他例子:
start /affinity 1 app.exe (only use CPU 0)
start /affinity 2 app.exe (only use CPU 1)
start /affinity 1F app.exe (only use CPUs 0, 1, 2, 3, and 4)发布于 2013-09-01 17:01:04
为了得到正确的HEX数,想象一下您的核心在平面格式8765 4321 (对于8核CPU)向后(但不像12345678)
要激活核心7、6和3,输入0x64进行关联:
/AFFINITY 0x64为了获得更好的外观,匹配和比较:0110 0100 - number = 0x64 (87654321)-核
@ladenedge示例:/AFFINITY AA 1010 1010 - number = 0xAA (87654321)-核
另见:启动分配给Windows 7、8或Vista中特定CPU的应用程序
发布于 2017-03-19 14:42:00
关于您自己的计算需求的更多信息:
CPU ID CPU value (dec)
0 001 (= 2^0)
1 002 (= 2^1)
2 004 (= 2^2)
3 008 (= 2^3)
4 016 (= 2^4)
5 032 (= 2^5)
6 064 (= 2^6)
7 128 (= 2^7)因此:
参考:在https://msdn.microsoft.com/en-US/library/ms187104.aspx上搜索‘这些是8 CPU系统的关联掩码值’模式。
https://stackoverflow.com/questions/7759948
复制相似问题