-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.ThreadingdocumentationDocumentation bug or enhancement, does not impact product or test codeDocumentation bug or enhancement, does not impact product or test code
Milestone
Description
We seem to also have ambiguity about what Environment.ProcessorCount returns. According to the docs, it should return "the number of processors on the current machine".
- On Windows without NUMA, it returns
SYSTEM_INFO::dwNumberOfProcessors. This sounds correct. I assume that this number cannot change during the process lifetime. - On Windows with NUMA, it returns
CPUGroupInfo::GetNumActiveProcessors. Can this number change during the process lifetime? - On Unix, with
HAVE_SCHED_GETAFFINITY, it returns the process affinity at the process start: https://github.com/dotnet/coreclr/blob/6ce179a17061abbbe9f904f878943a28c8041a62/src/pal/src/misc/sysinfo.cpp#L161 - On Unix ARM and ARM64, it returns
_SC_NPROCESSORS_CONF. This sounds correct. - On Unix on other platforms, it returns
_SC_NPROCESSORS_ONLNat the process start. That does not sound right.
Originally posted by @jkotas in dotnet/coreclr#27543 (comment)
Metadata
Metadata
Assignees
Labels
area-System.ThreadingdocumentationDocumentation bug or enhancement, does not impact product or test codeDocumentation bug or enhancement, does not impact product or test code