Jun 11, 2009

Actors and Distributed Computing

During my last post I spaced a fair bit and forgot to include a very important part about actors. I will now dedicate a whole post to that important part.

There are two requirements in an actor model: there is a way for an actor to reference another actor, and there is a way for the actor to send a message to that other actor. In a typical sequential OO program, this is done using instruction pointers and memory addresses and all that jazz. While it can also be done this way in an actor model, it is not restricted to this. For example, the way of referencing an actor can be done through the magical thing known as an IP address, and the way of calling an actor could be to send an HTTP request to that IP address. So in effect, many of us have already used the actor model without even knowing it!

The most important part of what I'm trying to say is that with an actor model when given two actors, these two actors may or may not be executing on the same machine.

An interesting thing is that this starts breaking down the definition of "program". A program can consist of several actors running across multiple machines within the same code-base, or can consist of several programs running across multiple machines and communicating with one another. Where does one draw the line? I can assume the Internet will not be referred to as a program, although technically it seems to follow the actor pattern.

No comments: