Windows 7 在Windows 7上使用start/affinity命令设置关联

Windows 7 在Windows 7上使用start/affinity命令设置关联,windows-7,command-line,affinity,Windows 7,Command Line,Affinity,我正在使用start/AFFINITY[n][.exe]命令启动具有指定AFFINITY的可执行文件。我的系统有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.

我正在使用
start/AFFINITY[n][.exe]
命令启动具有指定AFFINITY的可执行文件。我的系统有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.
亲和性与一个允许对所有处理器进行粒度控制的应用程序协同工作。请注意,最右边的位指定最低阶CPU(0)(请参阅)

对于所讨论的情况,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)

要获得正确的十六进制数,请想象您的内核是平面格式87654321(对于8核CPU),反向(但不像12345678)

要激活核心7、6和3,请键入亲缘关系的编号
0x64

/AFFINITY 0x64
为了获得更好的外观,请匹配并比较:
0110100
-number=
0x64
(8765 4321)-核心

对于@ladenedge示例:
/AFFINITY AA
1010 1010
-number=0xAA(8765 4321)-核心


另请参见:

有关您自己计算需求的更多信息:

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)
因此:

  • CPU ID 0、1、2、3、4、5、6、7的掩码:255(单个CPU十进制值之和),即十六进制的“FF”掩码
  • CPU ID 0、2、4、6:85(单个CPU十进制值之和)的掩码,即十六进制的“55”掩码

参考:在搜索“这些是8-CPU系统的关联掩码值”模式。

我的电脑似乎与你的电脑配置相同。请给出语法,以及如何添加它?我是这样说的:,但是,仍然很困惑。谢谢。只是补充一下,一个简单的方法来做到这一点。。。一旦你反向考虑你的处理器ID,只需进入calc并切换到程序员模式。在左边为二进制设置“Bin”,然后输入代码打开和关闭每一个,然后点击“Hex”。这将为您提供开始代码。