November 24, 2023
https://issues.dlang.org/show_bug.cgi?id=24260

          Issue ID: 24260
           Summary: GC creates too many threads when running with
                    restricted CPU affinity
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: druntime
          Assignee: nobody@puremagic.com
          Reporter: dlang-bugzilla@thecybershadow.net

Currently, the GC decides on the number of threads to create (for parallel marking) by querying the information in CPUID.

This is not ideal, because a process may be created with a CPU/core affinity restricting which CPUs/cores it may use, e.g. using the "taskset" utility. In this case, it will create too many threads.

It should instead use the information provided from the OS, in the same way that std.parallelism.totalCPUs does. (totalCPUs should probably be moved to Druntime.)

--