Windows desktop app: CPU under-utilization; application not being scheduled on all logical processors

Patrick Lynn 1 Reputation point
2022-10-14T09:48:34.357+00:00

I am a developer for a Windows desktop application that performs numerical calculations. We often need to run this program many times with somewhat different calculations, so on machines that have multiple logical processors we start several instances at the same time, with the expectation that the OS will schedule these onto different processors. The problem I am seeing is that on some machines, when I start multiple instances of this application, not all of the logical processors are used.

For example, one machine that exhibits this problem is an Intel(R) Core(TM) i9-10900X with 10 cores / 20 logical processors. When I start up 15 instances of my application, the task manager shows that the 15 processes are running on only 10 logical processors. The processors being used are those associated with even-numbered cores; that is logical processors 0, 1, 4, 5, 8, 9, 12, 13, 16, 17 on cores 0, 2, 4, 6, and 8. These processors are at 100% utilization and the other 10 processes are idle.

This does not appear to be a matter of process affinity. When I use the start command to explicitly set the affinity for all processes to all processors, the behavior is the same. If I set the affinity for all processes to the odd-numbered core's processors, only one of the first logical processor on each odd-numbered core is used (2, 6, 10, 14, 18). If I set each process to have a single, different processor affinity, they are all utilized fully, and the processes complete more quickly.

I have seen this behavior on some but not all multi-core machines to which I have access. For example, I see this behavior on the above machine, running Windows 11 Enterprise with an Intel(R) Core(TM) i9-10900X CPU, but not on another machine running Windows 11 Enterprise on an 11th Gen Intel(R) Core(TM) i7-11850H CPU with 8 cores and 16 processors.

The problem appears to have something to do with my particular application, as I do not see this behavior with other applications (e.g., a test application that just does some simple math).

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,827 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,134 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,441 Reputation points
    2022-10-19T07:29:41.063+00:00

    Hello there,

    For better performance, the operating system takes physical locality into account when assigning logical processors to groups

    When the system starts, the operating system creates processor groups and assigns logical processors to the groups. If the system is capable of hot-adding processors, the operating system allows space in groups for processors that might arrive while the system is running. The operating system minimizes the number of groups in a system. For example, a system with 128 logical processors would have two processor groups with 64 processors in each group, not four groups with 32 logical processors in each group.

    This might shed some insights about the process https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups

    By default, an application is constrained to a single group, which should provide ample processing capability for the typical application. The operating system initially assigns each process to a single group in a round-robin manner across the groups in the system.

    ------------------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.