Linuxには、特定のプロセスのCPUアフィニティを設定できるタスクセットユーティリティがあります 。
Windows環境に同等のものはありますか?
製品の最大CPUしきい値を設定したいのですが、この機能を提供するWindowsの既存のメカニズムはありますか?
何か助けがあれば、私の製品は.Netで開発されています
ありがとう
Linuxには、特定のプロセスのCPUアフィニティを設定できるタスクセットユーティリティがあります 。
Windows環境に同等のものはありますか?
製品の最大CPUしきい値を設定したいのですが、この機能を提供するWindowsの既存のメカニズムはありますか?
何か助けがあれば、私の製品は.Netで開発されています
ありがとう
はいあります:
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
。CPU0とCPU1にバインドするには、マスクを0x3
、などにする必要があります。
ProcessorAffinity
次の呼び出しによって取得可能な現在のプロセスのインスタンスのプロパティに同じ16進マスク値を割り当てることにより、コードでCPUアフィニティを設定することもできますSystem.Diagnostics.Process.GetCurrentProcess()
。
using System.Diagnostics;
Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)0x3;