Windows support for more than 64 logical processors are implemented
using processor groups.
Essentially what it's doing is keeping the existing maximum of 64 processors
and keeping the affinity mask a 64 bit value, but adds an hierarchy above that.
This support was added to Windows 7 and so we need to at runtime detect if
the APIs are still there due to our minimum supported version being
The Maximum number of groups supported at this time is 4, so 256 logical cores.
The group indices are 0 based. One thread can have affinity with multiple
and particularly helpful is the whitepaper:
'Supporting Systems that have more than 64 processors'
Processor groups are not guaranteed to be uniformly distributed nor guaranteed
to be filled before a next group is needed. The OS will assign processors to
groups based on physical proximity and will never partially assign cores from
one physical cpu to more than one group. If one has two 48 core CPUs then you'd
end up with two groups of 48 logical cpus. Now add a 3rd CPU with 10 cores and
the group it is assigned to depends where the socket is on the board.