Skip to content

std::thread::available_parallelism() is wrong about Windows 11/Server 2022 #152389

Description

@nabijaczleweli

std::thread::available_parallelism() says

On Windows:

  • It may undercount the amount of parallelism available on systems with more than 64 logical CPUs. However, programs typically need specific support to take advantage of more than 64 logical CPUs, and in the absence of such support, the number returned by this function accurately reflects the number of logical CPUs the program can use by default.

and per https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups#behavior-starting-with-windows-11-and-windows-server-2022 this was true before Windows 11/Server 2022, but on these and subsequent systems processes are usefully scheduled across all CPUs by default.

The implementation uses GetSystemInfo().dwNumberOfProcessors. I think GetActiveProcessorCount(ALL_PROCESSOR_GROUPS) will return the same data at full range?

Activity

  1. added
    C-bug
    on Feb 9, 2026
  2. added
    needs-triage
    on Feb 9, 2026
  3. oech3 commented on Feb 9, 2026

    @oech3

    How about quota? uutils/coreutils#9815

  4. added
    O-windows
    T-libs
    and removed
    needs-triage
    on Feb 9, 2026
  5. Noratrieb commented on Feb 9, 2026

    @Noratrieb
    Member

    @rustbot ping windows

  6. rustbot commented on Feb 9, 2026

    @rustbot
    Collaborator

    Hey Windows Group! This bug has been identified as a good "Windows candidate".
    In case it's useful, here are some instructions for tackling these sorts of
    bugs. Maybe take a look?
    Thanks! <3

    cc @albertlarsan68 @arlosi @ChrisDenton @danielframpton @dpaoliello @gdr-at-ms @kennykerr @luqmana @nico-abram @retep998 @sivadeilra @wesleywiser

  7. ChrisDenton commented on Feb 18, 2026

    @ChrisDenton
    Member

    Yes the documentation should be updated for the Windows 11 changes. There are also other issues with the implementation: #143709

  8. Joel-Wwalker commented on Jul 14, 2026

    @Joel-Wwalker
    Contributor

    @rustbot claim

  9. Joel-Wwalker commented on Jul 14, 2026

    @Joel-Wwalker
    Contributor

    Releasing this, got ahead of myself, not picking it up right now. Apologies for any inconveniences this may cause.

  10. Joel-Wwalker commented on Jul 14, 2026

    @Joel-Wwalker
    Contributor

    @rustbot release-assignment

  11. added a commit that references this issue on Jul 15, 2026
  12. added a commit that references this issue on Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugO-windowsT-libs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions