Skip to content

Count processors across all processor groups in Etc.nprocessors - #103

Merged
hsbt merged 3 commits into
masterfrom
claude/sleepy-noether-3bc2ba
Sep 27, 2026
Merged

hsbt merged 3 commits into
masterfrom
claude/sleepy-noether-3bc2ba

Conversation

@hsbt

@hsbt hsbt commented Sep 27, 2026

Copy link
Copy Markdown
Member

On Windows machines with more than 64 logical processors, Etc.nprocessors returned at most 64 because GetSystemInfo() only counts the current processor group. It now uses GetActiveProcessorCount(ALL_PROCESSOR_GROUPS), looked up at runtime so mingw builds targeting _WIN32_WINNT 0x0600 still compile. test_nprocessors now also checks the result against NUMBER_OF_PROCESSORS on Windows.

These commits landed in ruby/ruby first as ruby/ruby@fa3cbf9e76, ruby/ruby@17af2a8397 and ruby/ruby@41349bb1e8 (ruby/ruby#19070). I brought them here unchanged.

The CI here does not run on Windows, so I checked on x64 mswin that rake compile test passes. My machine has 24 logical processors in one group, so this check does not cover the more-than-64 case or the mingw build.

Generated with Claude Code

hsbt and others added 3 commits September 27, 2026 13:14
GetSystemInfo() reports the logical processors of the current processor group only, so Etc.nprocessors returned at most 64 on Windows machines with more than 64 logical processors. GetActiveProcessorCount(ALL_PROCESSOR_GROUPS) counts every group. It is looked up at runtime because mingw-w64 declares it only for _WIN32_WINNT >= 0x0601 while the mingw build targets 0x0600.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mingw-w64 guards the macro with _WIN32_WINNT >= 0x0601 as well as the function, while the mingw build targets 0x0600.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A missing variable turned the lower bound into 0, which the existing assertion already covers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@hsbt
hsbt merged commit e16b390 into master Sep 27, 2026
38 checks passed
@hsbt
hsbt deleted the claude/sleepy-noether-3bc2ba branch September 27, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant