On Tue, 2015-03-17 at 22:49 +0000, deadalnix via Digitalmars-d wrote: > On Tuesday, 17 March 2015 at 22:30:37 UTC, Andrei Alexandrescu > wrote: > > On 3/17/15 1:50 PM, Bienlein wrote: > >> > >>> Go is only a CSP-like, it isn't CSP. cf Python-CSP and PyCSP, > >>> not to > >>> mention JCSP and GPars. > >> > >> I'm not really sure whether this can be put exactly that way. > >> On a > >> machine with 4 GB RAM you can spawn about 80.000 goroutines > >> (aka green > >> threads). Let's say each threads calculates a large fibonacci > >> number. If > >> the fibonacci calculation yields the processor frequently all > >> 80.000 run > >> seamingly in parallel and return their result almost "at the > >> same time". > > > > How many physical threads would the 80K goroutines create? -- > > Andrei > > The Go runtime manages this. About as many as there are CPU.
The Go runtime manages the threadpool and scheduling of kernel threads, but the number of them remains a number specified manually unless you want the default of 1. Benchmarking generally reveals that optimal number of kernel threads in a pool is number of CPUs ±1, it depends on the work and things like cacheline misses, hyperthreads, etc., etc. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part