Actor Architecture
September 13, 2005
Myeong-Wuk Jang Open Systems Laboratory
Outline
Actor Model Actor Architecture (AA) Main Functions of AA GUI of an AA Platform Structure of AA Examples
Hello World!
Extended Operators Actor Migration Middle Actor Services
OSL - UIUC 2
09-13-05
The Actor Model
Definition of an Actor:
A self-contained, interactive, autonomous object that can communicate with other actors by asynchronous message passing.
Three Primitives:
create(b) send(a, m) become(b)
09-13-05
OSL - UIUC
3
Actor Architecture (AA)
Java Actor System AA Platforms
Actor execution environments
Actor Library
A development tool to implement actors on AA platforms.
09-13-05
OSL - UIUC
4
Main Functions of AA
Actor Operators
create, send, become createRemote, call, destroy, migrate actor state: active, suspended, transit, remote actor location
Actor Management
Actor Migration Middle Agent Service
matchmaking brokering
OSL - UIUC 5
09-13-05
Graphical User Interface
09-13-05
OSL - UIUC
6
The Structure of AA
Actor
AA Platform
Directory Manager
Advanced Service
Actor Manager
Actor Migration Manager
Actor Management Service
Delayed Message Manager
Message Delivery Service
Message Manager
Transport Receiver
Transport Manager
Transport Sender
Message Transport Service
Transport Sender
Transport Manager
Transport Receiver
Message Transport Service
AA Platform
09-13-05
OSL - UIUC
7
Actor Life Cycle
Remote
Suspended
Resume
Move Start Destroy
Suspend
Unknown
Move End
Execute
Transit Move Start
Create or Execute Active
09-13-05
OSL - UIUC
8
Actor Naming and Message
Message Passing Operator
send(anReceiver, “printString”, “Hello”);
UAN: Universal Actor Name
uan://128.174.245.49:37
Actor Communication Message
Sender UAN Receiver UAN Message (Method) Name Arguments Reply With Reply To
09-13-05
OSL - UIUC
9
Example 0: Hello World!
Hello
World
Hello World!
09-13-05
OSL - UIUC
10
Example 1: Hello World!
package app.quickstart.hello; package app.quickstart.hello; import aa.core.Actor;
import aa.core.Actor; import aa.core.CreateActorException;
public class Hello extends Actor { public Hello() { System.out.print(" Hello"); try { create("app.quickstart.hello.World"); } catch (CreateActorException e) { System.out.println("> Hello.Hello: " + e); } } }
public class World extends Actor { public World() { System.out.println(" World!"); } }
09-13-05
OSL - UIUC
11
Example 2: Hello World!
package app.quickstart.hello; package app.quickstart.hello; import aa.core.Actor;
import aa.core.Actor; import aa.core.ActorName; import aa.core.CreateActorException; public class Hello extends Actor { public Hello() { System.out.print(" Hello"); try { ActorName anWorld = create("app.quickstart.hello.World"); send(anWorld, “world”); } catch (CreateActorException e) { System.out.println("> Hello.Hello: " + e); } } }
public class World extends Actor { public World() { }
public void world() { System.out.println(" World!"); } }
09-13-05
OSL - UIUC
12
Example 3: Hello World!
package app.quickstart.hello; package app.quickstart.hello; import aa.core.Actor;
import aa.core.Actor; import aa.core.BecomeActorException;
public class Hello extends Actor { public Hello() { System.out.print(" Hello"); try { become("app.quickstart.hello.World"); } catch (BecomeActorException e) { System.out.println("> Hello.Hello: " + e); } } }
public class World extends Actor { public World() { System.out.println(" World!"); } }
09-13-05
OSL - UIUC
13
Extended Operators
createRemote(h, b):
creates an actor on the remote host computer. sends a message and waits for the reply. synchronous communication destroys the actor.
call(a, m):
destroy():
migrate(h):
moves the actor from its current host to another.
OSL - UIUC 14
09-13-05
Example 4: Hello World!
package app.quickstart.hello; package app.quickstart.hello; import aa.core.Actor;
import aa.core.Actor; import aa.core.CreateActorException;
public class Hello extends Actor { public Hello() { System.out.print(" Hello"); try { createRemote(“seine.cs.uiuc.edu”, "app.quickstart.hello.World"); } catch (CreateActorException e) { System.out.println("> Hello.Hello: " + e); } } }
public class World extends Actor { public World() { System.out.println(" World!"); } }
09-13-05
OSL - UIUC
15
Example 5: Hello World!
package app.quickstart.hello; package app.quickstart.hello;
import aa.core.Actor; import aa.core.ActorName; import aa.core.CreateActorException;
public class Hello extends Actor { public Hello() { try { ActorName anWorld = create("app.quickstart.hello.World"); send(anWorld, “start”, getActorName()); } catch (CreateActorException e) { System.out.println("> Hello.Hello: " + e); } }
import aa.core.Actor; import aa.core.ActorName;
public class World extends Actor { public World() { } public start(ActorName pan) { send(pan, “hello”); send(getActorName(). “world”); } public void world() { System.out.println(" World!"); } }
public void hello() { System.out.print(" Hello"); }
}
09-13-05
OSL - UIUC
16
Example 6: Hello World!
package app.quickstart.hello; package app.quickstart.hello;
import aa.core.Actor; import aa.core.ActorName; import aa.core.CreateActorException;
public class Hello extends Actor { public Hello() { try { ActorName anWorld = create("app.quickstart.hello.World"); send(anWorld, “start”, getActorName()); } catch (CreateActorException e) { System.out.println("> Hello.Hello: " + e); } }
import aa.core.Actor; import aa.core.ActorName;
public class World extends Actor { public World() { } public start(ActorName pan) { call(pan, “hello”); send(getActorName(). “world”); } public void world() { System.out.println(" World!"); } }
public void hello() { System.out.print(" Hello"); }
}
09-13-05
OSL - UIUC
17
Actor Migration
Operator
migrate(h)
Advantage
move the code for the better working environment run an actor on any computer host even if the binary code does not exist
09-13-05
OSL - UIUC
18
Message Passing for Mobile Actors
Two Approaches
UAN-based Message Passing Location-based Message Passing
LAN: Location-based Actor Name
lan://128.174.244.147//128.174.245.49:37
09-13-05
OSL - UIUC
19
UAN-based Message Passing
Actor Platform A: Actor Platform C:
UAN1://B:15
UAN2://B:16
UAN2 send a message tosend a message to UAN2 from UAN1 UAN1 UAN2 from UAN1 UAN1 UAN2
Actor Platform B:
UAN1://B:15
UAN2://B:16
09-13-05
OSL - UIUC
20
LAN-based Message Passing
Actor Platform A: Actor Platform C:
UAN1://B:15
UAN2://B:16
send a message to LAN2://C/B:16 from LAN1://A/B:15 LAN1://A/B:15 LAN1://C/B:16 send a message tosend a message to UAN2 from UAN1 UAN2 from UAN1
Actor Platform B:
09-13-05
OSL - UIUC
21
Matchmaking Service
Yellow Page Service Operators
register, deregister search, searchAll
Directory Manager
UAN1, UAN2 Sende r Actor Actor UAN1
searchAll
send
Actor UAN2
09-13-05
OSL - UIUC
22
Matchmaking Service
Directory Manager
UAN2, seller, computer, 950
UAN3, seller, computer, 650 UAN2, seller, printer, 120 UAN4, seller, computer, 1290
searchAll
UAN2, seller, computer, 950 UAN3, computer, 650 register register seller,UAN4, seller, computer, 1290 UAN2, UAN3, UAN4 ?, seller, computer, ? UAN2, seller, printer, 120 Model-XXX send getModelName send sendModelName
register
UAN1:buyer UAN2:seller
UAN3:seller UAN4:seller
send
getModelName
Model-YYY
09-13-05
OSL - UIUC
23
Brokering Service
Operators
register, deregister deliver, deliverAll
deliverAll
Directory Manager
send Actor UAN1
Sende r Actor
Actor UAN2
09-13-05
OSL - UIUC
24
Brokering Service
Directory Manager
UAN2, seller, computer, 950
UAN3, seller, computer, 650 UAN2, seller, printer, 120 UAN4, seller, computer, 1290
deliverAll
sendModelName ?, seller, computer, ? Model-XXX send getModelName
send
sendModelName
UAN1:buyer UAN2:seller
UAN3:seller UAN4:seller
send
getModelName
Model-YYY
09-13-05
OSL - UIUC
25
Summary
The Actor Architecture
actor execution environments
actor state management actor communication actor migration three actor primary operators extended operators
actor library
09-13-05
OSL - UIUC
26
Summary
Actor Communication
send: asynchronous communication call: synchronous communication Directory Manager: attribute-based communication
Actor Creation
create: local agent creation createRemote: remote agent creation
become
OSL - UIUC 27
Actor Evolution
09-13-05
References
Web site:
osl.cs.uiuc.edu/aa
The Actor Architecture Manual The Actor Architecture Quickstart Manual E-Mail:
mjang@uiuc.edu
09-13-05
OSL - UIUC
28
The End
Thanks for your attention.