On Sun, Jul 8, 2012 at 3:19 AM, rex goxman <lists / ruby-forum.com> wrote:

> I am reading Erlang documentation right now which which states that an
> Erlang process doesn't amount to much more than a pointer within the
> Erlang VM pointing off to some chunk of code/memory inside the Erlang
> VM, which explains why the processes are so lightweight.

And here is, I think, the crux of the cross communication.

It's pretty trivial to use Ruby Proc objects in exactly this way.
Write yourself a simple ProcScheduler, and you can, in Ruby, have very
lightweight green "processes". You can spawn a hundred thousand in a
second, and depending on what they are doing, all hundred thousand can
run in the same second.

Create a subclass of the Proc that you call a ScheduleableProc, add a
few methods to control runnable states, and to indicate whether a
given green process is alive or dead, and you can have a scheduler
that lets GC clean up those dead green processes, while the processes
themselves can manipulate whether or not they are runnable, and can
die when no longer needed.

Voila! Very lightweight "processes" that are similar in concept to the
kind of green threads or processes that you continue to refer to.

It's not really the same thing that Tony is talking about, though.


Kirk Haines