if you want to limit the number of Ps, then you use a cpuset, that sched_getaffinity will take into account. cgroups only allows you to limit cpu usage, but not lower the number of cpu cores the code can run on. This is “how many” versus “how much”, and GOMAXPROCS only relates to the “how many” part.
I may have misunderstood the rationale here, but I think the discussion about cgroup support is not about limiting the number of Ps
eadmund|1 year ago
> On Linux, go uses sched_getaffinity …
Since cgroups are a Linux-only feature, OP must be running Linux. I wonder if his experience pre-dates Go’s usage of sched_getaffinity.
edit: I realised that he references cgroups so must be on Linux.
Thaxll|1 year ago
lcof|1 year ago
I may have misunderstood the rationale here, but I think the discussion about cgroup support is not about limiting the number of Ps