4 ms·
Data races are a subset of all race conditions. We don't claim that it's impossible to wait on a network message that never arrives, of course! However, Pony m
by 0cachecoherency 11y ago
Data races are a subset of all race conditions. We don't claim that it's impossible to wait on a network message that never arrives, of course!
However, Pony makes a messaging order guarantee that's much stronger than is typical for the actor model. It guarantees causal messaging. That is, any message that is a "cause" of another message (i.e. was sent or received by an actor prior to the message in question) is guaranteed to arrive before the "effect" if they have the same destination.
That guarantee is achieved with no runtime cost, which is pretty fun.
Pony still allows unbounded non-determinism, of course, but causal messaging gives a very comfortable guarantee to the programmer.
- xjia 11y agoAny research paper or documentation on "That guarantee is achieved with no runtime cost"?
- lostcolony 11y agoEspecially if they're trying to include distribution (per a comment elsewhere). Pretty sure you can't have linearalizable messages between nodes without additional runtime cost compared to the non-linearalized case.
- AnkhMorporkian 11y agoDistribution probably (almost definitely) kills the runtime cost, I can't imagine how it couldn't. I'm much more interested in the causality guarantee in the context of the distributed systems.
- lostcolony 11y agoOh, agreed. But it's doable, provided you don't mind losing availability (which is...an interesting choice for a programming language), and you don't mind the runtime cost. But I agree, exactly what guarantees they're trying to provide (and is it opt in?) is an interesting question.
- kaeluka 11y agoI found: Clebsch, S., & Drossopoulou, S. (2013). Fully Concurrent Garbage Collection of Actors on Many-core Machines. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, 553–570. http://doi.org/10.1145/2509136.2509557 http://doi.org/10.1145/2509136.2509557 See p558, "Example 3"
- jlouis 11y agoYour causal message ordering guarantee sounds exactly like the Erlang one. If a pair of processes (P1,P2) is given and P1 sends m1 then m2, then P2 will see them in that order, perhaps interleaved with messages from other Pids. But your claim might be stronger, though I'm not sure in what sense it is stronger.
- n3otec 11y agoIn Erlang, that only holds for a pair of processes, as you point out. In Pony, it holds for the entire program. So, if A1 sends a message to A2, and then A1 sends a message to A3, and in response to the second message A3 sends a message to A2... in Pony, A2 is guaranteed to get the message from A1 before the message from A3.
- jlouis 11y agoI suspected as much. It is a pretty good guarantee. Have you found any use for it yet in programs? That is, a program where the causal message ordering is preferred and removes code from the program?
- Matthias247 11y agoThat's just what I was thinking about: Where would this be useful? On the other hand I could imagine that this could also cause problems: If you have a large program, could then this causality cause some messages to be delayed for a (too) long and not directly visible time in order to achieve the causality guarantee? But the claim was that there is no runtime overhead.
- kaeluka 11y agoUse: refactoring! I imagine: You have an actor A13 that communicates with actor A2. The guarantee allows you to break up A13 into the two actors A1 and A3 that now both communicate with A2 and be done with it. In erlang, you might not've done so, because you know nothing about message ordering in non-tree-shaped topologies.
- jlouis 11y ago