[dmd-concurrency] Sending mesages to non-listening threads
Robert Jacques
sandford at jhu.edu
Wed Jan 13 11:58:25 PST 2010
On Wed, 13 Jan 2010 13:49:49 -0500, Andrei Alexandrescu
<andrei at erdani.com> wrote:
> Robert Jacques wrote:
>> Erlang uses "passers" all the time. The difference is spinning off an
>> Erlang process is no big deal, so you don't think about it. Spinning
>> off an OS thread, on the other hand, is a big deal.
>
> Point taken. BTW we should reserve the possibility to implement abstract
> threads in D as well. I wonder how Erlang achieves its good performance
> numbers.
A key thing to remember is that Erlang's runtime is actually serial: on
multi-core machines it simply spawns multiple processes. This is a great
and efficient paradigm, (It makes the GC thread-local, etc) but it's
somewhat all or none. There are lot's of issues with mixing fibers and
threads without operating system support. I know it's broken pre-Vista on
Windows, because certain OS calls make some poor assumptions, resulting is
rare hard to track down bugs. I also know this effect third party
libraries do this too (OpenGL drivers, etc.). I don't know if the *nix
world has any hidden gotchas like that. I think message passing should
cleanly support D fibers, and we should encourage their usage: programming
with threads doesn't scale since inevitably you either have too many or
not enough.
One way to mitigate this is to have a task library like cilk or Intel's
Threading Building blocks.
More information about the dmd-concurrency
mailing list