Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Print Affinity Mask?

i want to print out affinitiy mask and how which CPUs are not enabled if there were turn off via task manager. 

here the sample code it does show when a core is disable but it will still list as 

1 2 3 4 5 6.. not like if CPU 2 gets turn off it show be 1 3 4 5 6

    HANDLE process = GetCurrentProcess();    DWORD_PTR processAffinityMask;    DWORD_PTR systemAffinityMask;    if (!GetProcessAffinityMask(process, &processAffinityMask, &systemAffinityMask))        return -1;    DWORD_PTR mask=0x1;    for (int bit=0, currentCore=1; bit < 64; bit++)    {        if (mask & processAffinityMask)        {        printf("Core %d \n", currentCore);            currentCore++;        }        mask = mask << 1;    }

1 Answer

Relevance
  • 2 weeks ago

    An affinity mask is a bit mask indicating what processor(s) a thread or process should be run on by the scheduler of an operating system. Setting the affinity mask.

Still have questions? Get answers by asking now.