some basic questions

Torbjorn Tornkvist <>
Fri Oct 8 03:28:12 CEST 1999

Hi !

> is there support in any of the libraries/contributions for multi-node
> message delivery, similar to those found in GCS type toolkits or does this
> abstraction have to be built? 

I dont' know what GCS is but here are the relevant man-pages
(you'll also find them at the web page under Documentation):

 rpc, pg, pg2, global, global_group, pool

also interesting:

 net_adm, net_kernel, auth

I know that there was some work done recently where lots
of ISIS "concepts" were implemented in Erlang. Don't know
what happend with it though... (Klacke ?)

> also, if i understand things, the order in
> which the message patterns are placed after the ``receive'' keyword is the
> order that the node will get the message, regardless of the actual order
> the messages came in.  is this right?  

No, the first message in the "message-queue" which match any of
the receive clauses will be taken. The test is aginst the receive
clauses is performed top-down, i.e assume you have three messages
in your message-queue (1,2,3) and three receive clauses in your
receive statement (a,b,c) then this will happend:

 + Try and match message 1 against:
   - message a
   - message b
   - message c
 + Try and match message 2 against:
   - message a
   - message b
   - message c
 + Try and match message 3 against:
   - message a
   - message b
   - message c

As soon you get a match, select that receive clause.
If no match continue to be suspended. See the code
and example at the end of this mail.

> next, from the literature i gather
> there aren't any gurantees for message delivery (no way to know if a
> message was consumed or not)

Correct !

To elaborate a little: 

Within a node, the only causes for failing to deliver a message are:

 1. Programming error (send message to wrong or non-existant process)
 2. No memory left in the system (but then you must have some other
    really serious programming faults in your programs)

Between nodes, you have the same problem as for any distributed
system. If the receiving system crashes or the network is cut off,
you can't know whether your messages was delivered or not.

>  -- is there any work being done on this?

There has been lots of work done for the general problems
around distributed systems/algoritms.

> finally, if a node fails, what can one assume about current processes at
> that node? 

Again, there is no way to tell whether is was the Node or 
the Network which went down.

Cheers /Tobbe
%%% The code %%%
-export([start/0, go/0]).

start() ->
    spawn(?MODULE, go, []).

go() ->
    io:format("Going to sleep !~n"),
    io:format("Woke up !~n"),

recv() ->
	{a,Msg} -> io:format("GOT: ~p~n",[Msg]);
	{b,Msg} -> io:format("GOT: ~p~n",[Msg])

sleep(Sec) -> receive after Sec*1000 -> true end.

%%% Test Run %%%
1> c(test).
2> P=test:start().
Going to sleep !
3> P!{b,"B"}.
4> P!{a,"A"}.
Woke up !
GOT: "B"

More information about the erlang-questions mailing list