Florian Weimer
unread,May 29, 2015, 10:05:29 AM5/29/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Andrew Gerrand, Dan Kortschak, Russ Cox, golang-dev
On 05/28/2015 10:37 PM, Andrew Gerrand wrote:
> I'm not aware of other popular multi-threaded languages that let you
> restrict the number of processes to consume. For instance, if I start a
> Java program that spins up 50 threads it could easily saturate 24 cores.
> Why should Go be special in this regard?
Maybe because goroutines aren't threads, and some applications create
them much more liberally, without concern for overscheduling?
Hotspot does limit then number of threads created by the VM proper (it
is up the application to limit itself):
// For very large machines, there are diminishing returns
// for large numbers of worker threads. Instead of
// hogging the whole system, use a fraction of the workers for every
// processor after the first 8. For example, on a 72 cpu machine
// and a chosen fraction of 5/8
// use 8 + (72 - 8) * (5/8) == 48 worker threads.
But Hotspot has an idea what those worker threads do.
At least the Go run-time counts affinity bits, so it responds well to
affinity tuning.
--
Florian Weimer / Red Hat Product Security