ErlCee++ (and starting remopte erlang nodes)
Joe Armstrong
joe@REDACTED
Tue Jun 8 14:35:59 CEST 2004
> Joe has often remarked that many of the nice properties of Erlang
> processes are shared by Unix processes, chiefly isolation. He flatly
> dismisses actually using OS ones just because he's an efficiency nut :-)
No - I'm an isolation nut - I'm well known for my efficient code :-)
>
> I'd really like to see an Erlang-like runtime system built on Unix
> processes. How far towards the Erlang programming style could it be
> pushed? Wouldn't it be fun to be able to write "Erlang" processes in
> any language and mix 'em all together?
Well one way to do this might be to use PVM.
<aside>
The other day I awoke with the thought "It's all about message
passing".
Q: How do we write distributed stuff?
A: Send asynchronous messages - you'll never know if they arrive
if you *must* know - send a reply
Note no shared anything :-) - easy to understand etc
How can I do this in a big network with firewalls etc. Can A send a
message to B if A and B are *both* behind firewalls etc. (yes send via
a proxy C - but both A and B must have agreed to communicate via some
proxy)
I asked my old friend Mr. Google about "message passing
infrastructures" and he told me about PVM ...
</aside>
Here are some quotes from http://www.csm.ornl.gov/pvm/intro.html
" PVM is a message passing system that enables a network of Unix
computers to be used as a single distributed memory parallel
computer. This network is referred to as the virtual machine....
In order to write a parallel program, tasks must be executed on
different processors....
... Here is an example of a typical call to pvm_spawn().
numt=pvm_spawn("my_task", NULL, PvmTaskDefault, 0, n_task, tids)
This spawns n_task copies of the program "my_task" on the computers
that PVM chooses. The actual number of tasks started is returned to
numt. The task id of each task that is spawned is returned in the
integer array tids. Every PVM process has a unique integer that
identifies it--this is its task id....
... After the data have been packed into the sending buffer, the
message is ready to be sent. This is accomplished with a call to
pvm_send().
info=pvm_send(tid, msgtag)
will send the data in the sending buffer to the process with the
task id of tid....
The receiving task makes a call to pvm_recv() to receive a message.
bufid=pvm_recv(tid, msgtag)
will wait for a message from task tid with tag msgtag to arrive, and
will receive it when it does.
Does any of this sound familiar?
Note that pvm_spawn spawns ANY process (ie not an Erlang process) -
so this could be used to remotely start an erlang process processes on
another node (ie it solve the problem raised in another thread).
PVM also has some nice introspection facilities (Goggle XPVM)
I haven't thought about it that much but it appears that a nice way
of interfacing Erlang with "foreign" applications would be to teach
Erlang to speak pvm - either by writing a linked in driver to allow
Erlang to send and receive pvm messages or by implementing the PVM
protocol in Erlang itself.
If you Google pvmbook.pdf you can find a very readably book about PVM.
Cheers
/Joe
[PS] If PVM is not the answer then what is? - All I want is simply
messag passing from A to B. TCP is too low-level and Erlang is too
specific.
I just want a simple C library to send and receive messages - handle
failures connect firewalled machines via proxies and have simple
(configurable) naming and security policies.
> Side notes:
>
> Linux 2.6 does one thousand context-switches per second, spends
> absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1).
>
> Memory is cheap.
>
> Cheers,
> Luke
>
More information about the erlang-questions
mailing list