Skip to content

Add Environment.TotalProcessorCount #29686

Open
@krwq

Description

@krwq

Created per offline feedback.

Consider adding something like Environment.TotalProcessorCount. The problem is Environment.ProcessorCount is returning a value designed for scheduling threads within a process. The Windows scheduler has a feature called processor groups that limits one process to at most 64 cores. However, if you’re writing code to schedule processes (instead of threads) then you need accurate machine-wide numbers.

It is currently possible to workaround this behavior by setting following env variables:

set complus_GCCpuGroup=1
set COMPlus_Thread_UseAllCpuGroups=1

but setting environment variables is not ideal as a permanent solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-needs-workAPI needs work before it is approved, it is NOT ready for implementationarea-System.Runtime

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions