How many std.concurrency receivers?

Sean Kelly sean at invisibleduck.org
Thu Oct 11 13:49:32 PDT 2012


On Oct 10, 2012, at 6:55 PM, Charles Hixson <charleshixsn at earthlink.net> wrote:
> 
> TDPL quotes the recommendation from an Erlang book "Have LOTS of threads!", but doesn't really say how to guess at an order of magnitude of what's reasonable for D std.concurrency.  People on Erlang say that 100's of thousands of threads is reasonable.  Is it the same for D?

Not currently.  spawn() generates a kernel thread, unlike a user-space thread as in Erlang, so you really can't go too crazy with spawning before the cost of context switches starts to hurt.  There was a thread about this recently in digitalmars.D, I believe.  To summarize, the issue blocking a move to user-space threads is the technical problem of making thread-local statics instead be local to a user-space thread.  That said, if you don't care about that detail it would be pretty easy to make std.concurrency use Fibers instead of Threads.


More information about the Digitalmars-d-learn mailing list