In Linux, there’s the taskset utility which allows you to set CPU affinity for a certain process.
Is there an equivalent in the Windows environment?
I want to set a maximum CPU threshold for my product, is there any existing mechanism in Windows that offers this capabilities?
If its any help, my product is developed in .Net
Thanks
Yes, there is:
and the option
/AFFINITY <hex affinity mask>in particular.If you’d like to bind to CPU 0 only, then specify affinity mask of
0x1. To bind to CPU 1 the mask should be0x2. To bind to CPU 0 and CPU 1 the mask should be0x3, and so on.You can also set the CPU affinity in code by assigning the same hexadecimal mask value to the
ProcessorAffinityproperty of the instance of the current process obtainable by callingSystem.Diagnostics.Process.GetCurrentProcess():