[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Erlang challenge
Scott McKay wrote:
> I'm up to my neck in alligators
I can't imagine what that's like, I have a hard enough time just dealing
with alligators up to my ass!
> and too busy to check for myself, but my curiosity is
> unbearable: can these first-class continuations take
> advantage of multiple processors? Via SMP? Over a network?
My understanding - which could be out of date wrt ETOS and (unreleased)
Gambit-C 4.0 - is that the implementation of threads on continuations is
intended to provide lightweight user-level threads which run in a single OS
thread, so doesn't directly support multiple processors.
However, combining this with the Erlang model could lend itself towards some
fairly simple ways to deal with multiple CPUs. A very simple but workable
solution could be to have each CPU run a different instance of the runtime
system, i.e. a different Erlang "node" (either on a separate OS thread or in
a separate process). Communication between continuation-based
threads/processes within a single node would benefit from the shared heap
model, with no copying and minimal communication overhead. Communication
between nodes, i.e. between CPUs or machines, would use a less direct
message passing system, like traditional Erlang. This would avoid any
issues with e.g. running a continuation in a different OS thread from the
one in which it was created. I have no idea if any of this kind of thing is
being done in ETOS.
BTW, in Gambit-68K, there's a 'future' construct designed to support
parallel processing "with lazy task creation". That seems to have been
built on top of PVM, a register-based parallel virtual machine:
This feature seems to have been lost in the more portable Gambit-C, though.