在Windows中等效的任务集

在Linux中,有一个taskset实用程序,它允许您为某个进程设置CPU关联。

在Windows环境中是否有相同的东西?
我想为我的产品设置一个最大的CPU阈值,在Windows中是否有任何现有机制提供这种function?

如果有任何帮助,我的产品是在.Net中开发的

谢谢

Solutions Collecting From Web of "在Windows中等效的任务集"

就在这里:

Starts a separate window to run a specified program or command. START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B] [command/program] [parameters] 

/AFFINITY <hex affinity mask>选项。

 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,则指定亲和性掩码0x1 。 绑定到CPU 1的掩码应该是0x2 。 绑定到CPU 0和CPU 1的掩码应该是0x3 ,依此类推。

您还可以通过将相同的十六进制掩码值分配给通过调用System.Diagnostics.Process.GetCurrentProcess()获得的当前进程实例的ProcessorAffinity属性来设置CPU关联性。

 using System.Diagnostics; Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)0x3;