Actor Languages Maher –Motivation –Actor –Actor system Bill –Communication mechanism –Structure of Actor languages –Act’s syntax and examples –Actor-based.

Slides:



Advertisements
Similar presentations
DISTRIBUTED COMPUTING PARADIGMS
Advertisements

Construction process lasts until coding and testing is completed consists of design and implementation reasons for this phase –analysis model is not sufficiently.
Agents & Mobile Agents.
Threads, SMP, and Microkernels
MPI Message Passing Interface
COMMUNICATING SEQUENTIAL PROCESSES C. A. R. Hoare The Queen’s University Belfast, North Ireland.
2 nd Microsoft Rotor Workshop, Pisa, April 23-25, SCOOPLI for.NET: a library for concurrent object-oriented programming Volkan Arslan, Piotr Nienaltowski.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Remote Procedure Call (RPC)
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
An Associative Broadcast Based Coordination Model for Distributed Processes James C. Browne Kevin Kane Hongxia Tian Department of Computer Sciences The.
Introduction To System Analysis and Design
Ordering and Consistent Cuts Presented By Biswanath Panda.
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Software Connectors. Attach adapter to A Maintain multiple versions of A or B Make B multilingual Role and Challenge of Software Connectors Change A’s.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
Concurrency CS 510: Programming Languages David Walker.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
SE-565 Software System Requirements More UML Diagrams.
C++ fundamentals.
What is Concurrent Programming? Maram Bani Younes.
Object Oriented Software Development
Computer Architecture Computational Models Ola Flygt V ä xj ö University
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
SALSA: Language and Architecture for Widely Distributed Actor Systems. Carlos Varela, Abe Stephens, Department of.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Introduction To System Analysis and Design
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
- 1 - Embedded Systems - SDL Some general properties of languages 1. Synchronous vs. asynchronous languages Description of several processes in many languages.
DISTRIBUTED COMPUTING PARADIGMS. Paradigm? A MODEL 2for notes
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
1 Advanced Behavioral Model Part 1: Processes and Threads Part 2: Time and Space Chapter22~23 Speaker: 陳 奕 全 Real-time and Embedded System Lab 10 Oct.
Coordination Models and Languages Part I: Coordination Languages and Linda Part II: Technologies based on Tuple space concept beyond Linda Part III: Comparison.
Transparent Mobility of Distributed Objects using.NET Cristóbal Costa, Nour Ali, Carlos Millan, Jose A. Carsí 4th International Conference in Central Europe.
Actors: a model of concurrent computation in Distributed Systems Amin Saremi Hamid Mohamadi.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Shuman Guo CSc 8320 Advanced Operating Systems
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
ACTORS. Motivation Develop language for concurrency “ Parallel Execution of actions ”.
Distributed Computing Paradigms1. 2 Paradigms for Distributed Applications Paradigm means “a pattern, example, or model.” In the study of any subject.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
Concurrent Object-Oriented Programming Languages Chris Tomlinson Mark Scheevel.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Agenda  Quick Review  Finish Introduction  Java Threads.
Channels. Models for Communications Synchronous communications – E.g. Telephone call Asynchronous communications – E.g. .
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
OOP - Object Oriented Programming
Processes and threads.
Real-time Software Design
#01 Client/Server Computing
Mobile Agents.
Channels.
Channels.
Channels.
Concurrent Programming Actors, SALSA, Coordination Abstractions
#01 Client/Server Computing
Presentation transcript:

Actor Languages Maher –Motivation –Actor –Actor system Bill –Communication mechanism –Structure of Actor languages –Act’s syntax and examples –Actor-based languages Jack –SALSA –Mobile Agent –Conclusion

Actor Languages Maher Shinouda

Objectives Motivation Brief history What are actors Characteristics of actor-based languages Actor communication Events in actor languages Actor system Actor’s behavior Simple Example Actors VS Linda

Motivation Develop language for concurrency “Parallel Execution of actions”. Concurrency in distributed systems exhibits: –Divergence –Deadlock –Mutual Exclusion

Brief History A number of individuals have contributed to the development of the actor model. Actor model was first described by Carl Hewitt (70’s) –The model was object-oriented: every object was a computationally active entity capable of receiving and reacting to messages. The Objects were called Actors. Gul Agha, later develop the actor model and develop a mathematical theory of actors. Actor languages can all trace its ancestor either directly or indirectly to Lisp.

What are Actors Actors are independent concurrent objects that interact by sending asynchronous messages; each actor has its mail address and a behavior. An actor can do the following: Send communication to other actors. Create new actors. Define a new behaviour for itself, which may be the same or different to its previous behaviour.

Three actions an actor may perform

What are Actors Anatomy of Actor

Characteristics of Actor-based language Encapsulation All procedures and declarative information are encapsulated into a single entity “Actor”. Actors share the main characteristics of objects in Simula and Smalltalk. Actors considered to be Autonomous objects.

Characteristics of Actor-based language (Cont.) Inheritance In OOP, Each object is related to a class and further more the class may be an object belonging to meta- class. The notion of class is not integral to the actor model. Inheritance in actors provide a conceptual organization of the system which is dynamically reconfigurable.

Characteristics of Actor-based language (Cont.) Delegation Sub-computation can be passed on by an actor to another actor which continue the processing. Delegation promote modularity of the code. Concurrency Actor language allow actors to specify a replacement which has 2 implications: –Capture history-sensitive information. –Allow for concurrent execution of expressions that don’t involve data dependency.

Actor Communication Actor communicate using message passing only. All communication is asynchronous. Each Actor has mail address with mail queue. An actor may know the mail address because: –It has always know the address. –It received the address within a communication from another actor. –It created the address as part of creating another actor.

Actor communication (cont.) A message (Task) is represented as 3 tuples: 1- A tag which distinguish it from other tasks in the system. 2- A target which is the mail address to which the communication is to be delivered. 3- A communication which contain information which made available to the actor at the target.

Actor Actor = Component An actor is a special type of object that: Communicates with other actors by sending and receiving data via the mail address. No shared state between actors. An actor may be described by specifying: Its mail address with sufficiently large mail queue. Behavior, which is a function of the communication accepted.

Event What is event? An event cause a communication to be sent; or represent the processing of the communication. Arrival order of events is nondeterministic. Actor computation may be represented by event diagram.

Event Diagram

Actor System Group of actors within it and the set of tasks to be carried out. Two types of special actors needed: A receptionist: An actor which may receive communication from outside the system. An external actor: Is one which is not in the system but its address is known to one or more actors within the system, allowing them to send communication. A C B

The basic constructs A program in an actor language consists of: behavior definitions: which simply associate a behavior schema with an identifier. new expressions: which create actors. Send commands: which create tasks.

The basic constructs (cont.) A receptionist declaration: which lists actors that may receive communications from the outside. An external declaration: which lists actors that are not part of the system but to whom communications may be sent from the system.

Actor’s behavior The behavior of actor consists of three kind of actions: Create actors with specified behavior. ::= new ({expr{, expr}*}) Send message asynchronously to specified actor. ::= send to Become a new actor, assuming a new behavior to respond to the next message. become

Actor System (cont.) Two important facts about mail system in the actor system: Mail arrives in random, non deterministic order (asynchronous). Ensures concurrent execution. The mail delivery is guaranteed. The system guarantee to execute all tasks eventually.

Simple Example actor AdderAndMutlipy (Double k) Double A, Double B ==> Double C: action [a], [b] ==> [c] with Double c: c:=k*(a+b): endaction endactor

Another Example actor AdderAndMutlipy2[T] (T k) T A, T B ==> T C: action [a], [b] ==> [k*(a+b)]: endaction action [a], [] ==> [k*a]: endaction action [], [b] ==> [k*b]: endaction endactor

Actors VS Linda Provide point-to-point communication and object- style encapsulation. The locality property in actor: there is no way for an actor to contact other actors whose name hasn’t received in a previous communication. Actors are components. Provide pattern directed invocation Decoupled in both space and time: Information may be available so that any one can potentially access it. Linda doesn’t include the notion of component directly; nevertheless, the Tuple Space that it defines can be viewed as a generic connection component.

Manifold Inter-process communication in MANIFOLD is asynchronous, using broadcast of events and a dynamic data-flow.

Actor Languages Communication mechanisms Structure of Actor Languages Kernel language Act Actor-based languages Lehui (Bill) UW

Communication mechanisms Actors are active objects which communicate by message passing Asynchronous buffered communication –It's hard to imagine a reasonable system built on asynchronous, unbuffered communication. Too much would get lost.

Communication mechanisms Communication is asynchronous, without any guaranteed arrival order. –Message order: if actor A sends a sequence of communications to actor B, then B may not receive them in the same order that A sent them. –It is possible for A to tag each message with a sequence number, so that B may rearrange messages into the correct order.

Communication mechanisms Shared variables are not allowed in the actor model. –Shared variables means that they provide data transfer without any coordination mechanism or concurrency control. Variables sharing further complicates distribution and synchronization. –Latency and timing issues make it awkward to use shared variables in an asynchronous environment.

The Structure of Actor Languages

Control structure: recursive factorial computation When actor factorial receives 3 and mail address c, it creates a new actor m, and sends itself the request to evaluate the factorial of 2 When actor m receives a result, m multiplies 3 and the result and send to c There is nothing inherently concurrent in the recursive algorithm to evaluate a factorial.

Comparison Sequential language –Using a stack of activations. –No mechanism for distributing the work of computing a factorial or concurrently processing more than one request. Actor-based language –Creating actors which waits for the appropriate communications. They are free to concurrently process the next communication. –Delegating most of the processing to a large number of actors. –Given a network of processors, an actor-based language could process a large number of requests much faster by simply distributing the actors it creates among these processors.

Join continuations: tree product Divide and conquer concurrency can often be naturally expressed by using a functional form which evaluates its arguments concurrently. Join continuation is used to synchronize the evaluation of the different arguments.

Tree product event diagram

Language Act Act is a sufficient kernel for Act3 Syntax – ::= * ( *) – ::= (define (id {(with identifier )}*) *) – ::= (Is-communication do *)

Language Act – ::= | | | – ::= (let ( *) do *) – ::= (if (then do *) (else do *)) – ::= (send ) – ::= (become )

Example: Factorial c

Actor-based languages nameoriginsnotes PLASMA (1975) -The first actor language. Planner-like System Modeled on Actors. Originally called Planner-73, and implemented in MacLisp. Lisp-like syntax, but with several kinds of parentheses and brackets. "A PLASMA Primer", B. Smith et al, AI Lab Working Paper 92, MIT Oct "Viewing Control Structures as Patterns of Passing Messages", C. Hewitt, AI Lab Memo 410, MIT Act 1 (1981) LispDescendant of PLASMA. "Concurrent Object Oriented Programming in Act1", H. Lieberman in Object Oriented Concurrent Programming, A. Yonezawa et al eds, MIT Press Written in LISP by Henry Liberman Act 3 (1985) (1987) LispProvides support for automatic generation of customers and for delegation and inheritance. "Linguistic Support of Receptionists for Shared Resources", Carl Hewitt et al in Seminar on Concurrency, S.D. Brookes et al eds, LNCS 197, Springer 1985, pp

Actor-based languages nameoriginsnotes ABCL/1 (1987, 1990) Common LISP an extension of Common LISP An Object-Based Concurrent Language. Yonezawa, U Tokyo Language for the ABCL concurrent (MIMD) system. Asynchronous message passing to objects. Implementations in KCL and Symbolics LISP available from the author. "ABCL: An Object-Oriented Concurrent System", A. Yonezawa ed, MIT Press ftp://camille.is.s.u-tokyo.ac.jp/pub/ info: ABCL/c+ (1988) CConcurrent object-oriented language, an extension of ABCL/1 based on C. "An Implementation of An Operating System Kernel using Concurrent Object Oriented Language ABCL/c+", N. Doi et al in ECOOP 88, S. Gjessing et al eds, LNCS 322, Springer Concurrent Aggregates (CA) (1990) -Concurrent object-oriented language based on the Actor model plus RPC. Pure object oriented, single inheritance, with first class selectors, continuations and messages. "Concurrent Aggregates: Supporting Modularity in Massively Parallel Programs", Andrew A. Chien. Compiler for CM5 and workstations.

Actor-Based Concurrent Language (ABCL) Message sending order from one object to another is preserved in ABCL. Three types of message passing mechanisms –Past Non-blocking messages without a reply –Now Blocking messages with sender waiting for a reply –Future Non-blocking messages with a reply expected in the future

Concurrent Aggregates (CA) Extends the Actor model with inheritance and aggregates An aggregate is a group of actors of the same kind. All constituent actors share the same name. A message sent to the aggregates is processed by one and only one constituent but which constituent receives the message is left unspecified (i.e., one-to-one-of-many type of communication). Unlike the Actor model, every message send in CA expects a reply by default.

Rosette The most commercially successful actor-based language up to now Used as a language for the interpreter of the extensible services switch in the Carnot project at Microelectronics and Computer Technology Corporation (MCC) Continues to be used to provide heterogeneous interoperability for middleware in intranet and enterprise integration software With Rosette, the object-oriented programming model and the concurrent execution model are combined to simplify the development of autonomous, distributed agents.

Active Object Passive object oriented language –Separation of state (procedure and data) and thread manipulating that state Active object oriented language –Encapsulation of state and thread –More appropriate for implementing concurrent and distributed systems

Actor Languages SALSA Mobile Agents What are Aglets? Conclusions Questions? Jack

Execution environment

Execution environment (cont.) The execution environment Application running on the Internet, or on limited- resource devices, need to adapt to changes in their execution environment at run-time. eg. db2 get dbm cfg db2 get db cfg

Problem Current languages and systems fall short of enabling developers to migrate and reconfigure application sub-components at program-execution time. Concurrent execution environment.

SALSA Simple Actor Language, System and Architecture Features: –Simplifies programming dynamically reconfigurable. Open application by providing universal name, active objects and migration. –Token-passing continuations, join continuations and first-class continuations.

Requirements Internet and mobile computing place new demands on applications, which require them to be open and dynamically reconfigurable. Java is popular today. However, higher-level programming languages are required, in order for applications to be reconfigured, migrate to other platforms, and decomposed and re-composed arbitrarily.

SALSA SALSA program can be easily preprocessed to Java and preserve Java’s useful object- oriented concepts.

A HelloWorld program in SALSA Module helloworld Behavior HelloWorld { void act(String arguments[]){ standardOutput <- print(“Hello standardOutput <- print(“World”); }

A HelloWorld program in SALSA (cont.) An arrow (<-) indicates message sending to an actor. The at-sign indicates a token-passing continuation. SALSA programs are grouped into related behaviors, which are called modules. A module can contain several interfaces and behaviors.

A HelloWorld program in SALSA (cont.) A behavior can extend another behavior (Single inheritance) Every behavior extends a top-level UniversalActor behavior. A SALSA behavior can implement zero or more interfaces (multiple interface inheritance)

Creating a HelloWorld actor HelloWorld helloworld = new HelloWorld();

SALSA programs preprocessing SALSA Source code Program.salsa Program.java SALSA actor library Program.class JVM >>salsac Program.salsa >>javac Program.java >>java Program

Continuations In order to coordinate multiple actors, we introduce 3 types of continuations: Token-passing continuations Join continuations First-class continuations

Token-passing continuations Each message sent to an actor is equivalent to a method invocation in Java. A token is essentially the return value of the previous method invocation. An example

Join continuations A customer actor will receive an array with the tokens returned by multiple actors, once they have all finished processing their messages. (… other statements);

First class continuations First-class continuations enable actors to delegate computation to a third party, independently of the context in which message processing is taking places.

Problem of Threads Communication Link

Internet computing/World Wide Computer

A WWC is a set of Virtual Machines, or Theaters. A theater is associated with a UAL (Universal Actor Location) eg. rmsp://wwc.aa.com/agent An actor is bound to a UAN (Universal Actor Name) eg. uan://wwc.travel.com/agent RMSP stands for “remote message sending protocol” Actors of WWC is similar to the mobile agents in many aspects.

Mobile Agent

Mobile Agent (cont.) A mobile agent is a program that can migrate from machine to machine in a heterogeneous network. The program chooses when and where to migrate. It can suspend its execution at an arbitrary point, transport to another machine and resume execution on the new machine.

Mobile Agent vs Stationary agent Mobile network agents are programs that can be dispatched from one computer and transported to a remote computer for execution.

7 good reasons to use mobile agents They reduce network load They overcome network latency They encapsulate protocols They execute asynchronously and autonomously. They adapt dynamically. They are naturally heterogeneous. They are robust and fault-tolerant.

Java Mobile Agent Why Java Mobile Agent? –Wide acceptance and popularity of Java technology. –Object serialized mechanism and security model enforced by the JVM. –Platform independence. Write once, run anywhere.

Aglets Aglets are Java objects that can move from one host on the Internet to another. That is, an aglet that executes on one host can suddenly halt execution, dispatch itself to a remote host, and resume execution there. When the aglet moves, it takes along its program code as well as its data.

Developed at IBM Tokyo Research Laboratory Aglets has become an open source project Current release is version Can work with new Java 2 security model. Has been tested with JDK Easy installation with ant (Java build tool) only 2 environment variables required.

Tahiti Server

Package structure com.ibm.aglet com.ibm.aglet.event com.ibm.aglet.security com.ibm.aglet.system com.ibm.aglet.util com.ibm.aglets com.ibm.aglets.security com.ibm.aglets.tahiti com.ibm.agletx.patterns com.ibm.agletx.util com.ibm.atp com.ibm.atp.auth com.ibm.awb.launcher com.ibm.awb.misc com.ibm.awb.weakref

Package structure (cont.) com.ibm.maf com.ibm.maf.atp com.ibm.maf.rmi com.ibm.net.protocol.atp com.ibm.net.protocol.rmi org.aglets.log org.aglets.log.console org.aglets.log.log4j org.aglets.log.quiet

An Aglet class package auction; import com.ibm.aglet.*; import com.ibm.agletx.patterns.*; import java.util.*; import java.awt.*; import java.io.*; import java.net.*; public class MyAglet extends Aglet { public void run() {} }

Aglets’ communications Aglet/App ProxyAglet Message Reply Message Reply

Hosting of Incoming Aglets JVM Security Layer Aglet Host Computer Aglet Server Aglet Network traffic

Aglets versus applets Both are mobile code. A container is required before the code migration. Life cycles are managed by a container. Security is enfored by security manager. Aglets carry their own states but applets usually do not.

Application - Auction Market Place s

Interactions between Auctioneers & Bidders Create auctioneers for certain number of auction market places. Created 4 auctionners and move to their market places. 10 bidders created to join bids in each market place. Bidders post bids (thru sending messages to auctioneers) and/or move to the next market place. Auctioneers notify the winners (sending messages back to bidders).

Demo

Conclusion We think of components as composed of a collection of autonomous entities called actors. They are objects:encapsulates methods, interface, data They are autonomous:encapsulates a thread of control They interact with each others and the environment by sending messages. The ease with which actors can migrate makes them a natural model for mobile agents.

Questions?