From: Dmitrii Dimandt <dmi...@dmitriid.com>
To: Erlang Questions <erlang-q...@erlang.org>
Sent: Monday, January 28, 2013 10:00 AM
Subject: [erlang-questions] Message order and exit(Reason)
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
But this is true only for single-node semantics/settings, correct?
At least I this paper[1] by Koen Claessen and Hans Svensson claims that:
> In Fredlund’s semantics the delivery of a message is instantaneous,
> meaning that all messages are delivered in exactly the order they are
> sent. Now, this is actually true for processes running on the same
> node, due to how the Erlang runtime system is implemented. It is,
> however, not true in general for a concurrency oriented programming
> language, and specifically not in a distributed setting with several
> different Erlang nodes.
In general, they have a similar example to the one described in this
thread where problems with the exit signal appear in Chapter 5 and conclude:
> After Fredlund proposed his single-node semantics, it was at least
> thought ”morally OK” to use this semantics to reason about and model
> distributed systems. However, messages actually can and do
> arrive in different orders in a distributed setting as compared to a
> local setting. A simple experiment involving 3 nodes already shows
> this, even when the nodes are implemented as 3 run-time systems
> running on the same workstation! Moreover, we discovered that the
> above was not merely a theoretical anomaly, but an actual problem
> with a real-life implementation. Along the same lines, many Erlang
> developers think it morally OK to test their distributed system on a
> single node. For the same reasons as mentioned above, errors might
> slip through.
There's also a more recent one[2] by Hans Svensson.
So I guess the moral is that it's not all so simple and nice when you
"really" start distributing and it's not a good idea to make strong
assumptions even about the tiniest details.
Regards,
Ignas
[1]: "A Semantics for Distributed Erlang", 2005:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.101.9412
[2]: "A more accurate semantics for distributed Erlang", 2007:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.102.1723
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.102.1723>
These are different things. The delivery order of signals between two
*specific* processes is always guaranteed, even in a distributed
setting. Even if process A is on node 1 and process B is on node 2, it's
easy to preserve the order. What Fredlund is talking about is the
message order over all sends in the system. They do not model the time
it may take in a distributed system for a message to be transferred from
the sender to the mailbox of the receiver. Within a single node, it
*used to* be the case that this operation was atomic. However, in a
modern Erlang node on a multicore machine, there may be several sends
being performed by different scheduler threads in true concurrent
fashion, so the atomicity assumption is fundamentally broken.
> In general, they have a similar example to the one described in this
> thread where problems with the exit signal appear in Chapter 5 and conclude:
>
>> After Fredlund proposed his single-node semantics, it was at least
>> thought ”morally OK” to use this semantics to reason about and model
>> distributed systems. However, messages actually can and do
>> arrive in different orders in a distributed setting as compared to a
>> local setting. A simple experiment involving 3 nodes already shows
>> this, even when the nodes are implemented as 3 run-time systems
>> running on the same workstation! Moreover, we discovered that the
>> above was not merely a theoretical anomaly, but an actual problem
>> with a real-life implementation. Along the same lines, many Erlang
>> developers think it morally OK to test their distributed system on a
>> single node. For the same reasons as mentioned above, errors might
>> slip through.
>
> There's also a more recent one[2] by Hans Svensson.
>
> So I guess the moral is that it's not all so simple and nice when you
> "really" start distributing and it's not a good idea to make strong
> assumptions even about the tiniest details.
No, the ordering guarantees exist and can be relied on. You just can't
assume a total order, even if that assumption makes your model easier to
reason about. Your results won't be applicable on the real world.
/Richard
> On Monday, January 28, 2013, Richard O'Keefe wrote:
>
>> Unless you are deliberately using American speling, s/behavior/behaviour/.
>> The English spelling of behaviour is usual in Erlang.
>
> So the guy who wants to be able to write Erlang in Maori wants to prohibit us from writing in American English.
You *quoted* the part "Unless you are deliberately using American speling".
Did you *read* it?
Where does it say "don't write in American"?
(As opposed to say Microsoft Word, which does its level best to stamp out
non-American varieties of English.)
The point at issue is not dialect X vs dialect Y but *consistency*.
To quote another chunk of Erlang documentation,
Behaviour Module Attribute
It is possible to specify that the module is the callback
module for a behaviour:
-behaviour(Behaviour).
The atom Behaviour gives the name of the behaviour, which
can be a user defined behaviour or one of the OTP standard
behaviours gen_server, gen_fsm, gen_event or supervisor.
The spelling behavior is also accepted.
Read more about behaviours and callback modules in OTP Design
Principles.
Given _that_, was it really so unlikely that the omission of the
'u' from the word was an _unintential_ typo?
There may well be other places where the word has been differently
spelled. My point is not to follow this spelling or that speling
but to pick one and stick to it.
And what I said in an earlier thread was that I wanted my *students*
to be able to write Erlang in Māori because it is a policy of this
University that students should be allowed to perform assessment work
in Māori.