archives

Implementing the communication semantics of actors

It would be interesting to see an implementation of the actor semantics for communication and concurrency. Personally I would like to see a description of the execution flow that is concrete enough to show any similarities and differences from other models. There have been some threads on LtU that have languished on these details. Generally it appears (to me, at least) that there is an interest in seeing a description detailed enough that it could serve as the basis of an implementation.

In particular, if I squint a little at the SimpleCounter example (which sadly I cannot cut and paste here directly) then I see a FSM with access to an RNG, a timer, and a message queue. In previous discussions (from memory) I believe that Carl has stated several times that there is no queue. It seems a little unclear exactly what kind of RNG would be used, with respect to fairness and justice. In order to examine the semantics of the message passing and execution flow within an actor - that is erase all value computations and look only at an abstract model of concurrency and communication - then I would sketch out the following as a starting point:

Each actor is a set of message handlers and a set of incoming messages.

  • To send a message is an asynchronous operation - add the message to the target message set.

  • To start a computation is a synchronous operation - fire the asynchronous message and start a timer.

The execution of an actor proceed locally as is a series of steps in which either:

  • A timer has expired and a synchronous computation propagates failure instead of receiving a value.

  • Pick a random message from the set and process it.
    • If the message handler returns a value then fire it back as an asynchronous message.

From this starting point I would then ask:

  • Is this an accurate description - are these true statements about how the system behaves, and where they are not how does the system differ in behaviour?
  • Is this a complete description - where are the holes in this description that allow a diverge from the behaviour of actors?