Reputation: 1098
I have a PowerShell script that cycles through each available core by using the (Get-Process xyz).ProcessorAffinity = n
property.
However apparently this runs into problems once your CPU exceeds the 64 CPU/processors/threads limit, since Windows itself can only handle 64 CPUs (or "logical cores") for the affinity (due to a 64bit bitmask), and if there are more than 64, they are split up into multiple Processor Groups.
However there doesn't seem to be a way to set this Processor Group with PowerShell, at least I haven't found it yet.
For example I would like the script to change the affinity for a running process from core 63 to 64, then to 65, and so on. I don't need it to run across multiple Processor Groups at the same time.
Apparently I can't use (Get-Process xyz).ProcessorAffinity
for this. Is there a dedicated PowerShell command to switch to a different group or do I need to venture into C#/.NET for this and invoke e.g. SetThreadGroupAffinity()
for each thread of the process I want to change affinity for?
The target systems would be both Windows 10 and 11. For the latter there seem to have been some changes (see the Processor Groups page from above), but I guess making it work on W10 should also be enough for W11.
Upvotes: 0
Views: 139