380 likes | 493 Views
Faculty Of Computer Science Simon Fraser University Cmpt 880 presentation An Abstract Communication Model Uwe Glasser, Yuri Gurevich and Margus Veanes Presented by: Xianghua Jiang. Agenda. Origin of the Abstract Communication Model (ACM)
E N D
Faculty Of Computer Science Simon Fraser University Cmpt 880 presentation An Abstract Communication Model Uwe Glasser, Yuri Gurevich and Margus Veanes Presented by: Xianghua Jiang
Agenda • Origin of the Abstract Communication Model (ACM) • Basic Abstract State Machine (ASM) • Parallel ASM • Distributed ASM • ASML • Simulation of Agents • ACM • Reuse of ACM • Summary
ORIGIN OF ACM • The model was developed in the process of specifying UPnP architecture. • UPnP is an industrial standard for dynamic peer to peer networking. • The model is based on distributed abstract state machine (DASM). • The model is implemented in the specification language Asml.
BASIC ASMs • A basic ASM consists of a basic ASM program together with a collection states (the legal states of the ASM) and subcollection of initial states. • Basic ASMs are sequential algorithm.
ASM STATES • States of ASM are first-order structures. • Syntax of the state • Semantic of the state
SYNTAX OF THE STATE • Vocabulary is a collection of function symbols and relation symbols (or predicates). • Every vocabulary contains: • Equality Sign “=“; • Logic symbols true, false, undef; • Standard propositional connetives.
SEMANTICS OF STATE • A state X of a given vocabulary Y is a nonempty set S (base set of X), together with interpretations of the function symbols and relation symbols in Y over S.
SEMANTICS OF STATE • A state X of a given vocabulary Y is a nonempty set S (base set of X), together with interpretations of the function symbols and relation symbols in Y over S. • Function: f(x1, ……, xn) Function F: Sx…xS S • Relation: p(x1, ……, xn) Relation P Sx…xS
ASM STATES UPDATE • State is a kind of memory. • A location of a state A is a pair (f, a) • The content of the location is y = f(a). • An update of state A is a pair (l, y’) • To fire the update (l, y’), replace the old value y at location l with the new value y’.
SEQUENCIAL ALGORITHM • Let A be a sequential algorithm • A set S(A) whose elements will be called states of A • A subset L(A) of S(A) whose elements will be called initial states of A • A Map TA: S(A) -> S(A) that will be called the one-step transformation of A
SEQUENCIAL ALGORITHM • Let A be a sequential algorithm • A set S(A) whose elements will be called states of A • A subset L(A) of S(A) whose elements will be called initial states of A • A Map TA: S(A) -> S(A) that will be called the one-step transformation of A A run (or computation) of A is a sequence X0, X1, X2,……. Where X0 is an initial state and every Xi+1 = TA (Xi)
SEQUENCIAL ALGORITHM IN BASIC ASM • The run of a machine is a series of states and state transitions that results from applying operations to each state in succession.
THE RUN OF ASM • Vocabulary: mode, orders, balance • 3 states: S1, S2, S3 • 2 transitions: Initialize,Process All Orders
BASIC ASM PROGRAMS • An ASM program: entire definition of a machine, including the names of its state variables. • Control logic is the portion of program made up of the rules governing the state transitions. • A update rule R: f(e1,….ej) := e0 • A conditional rule R: if e then R1 else R2 • A do-in-parallel rule R: do in – parallel R1 R2
PARALLEL ASMS • Parallel ASMs are parallel algorithms. • Example: the ages of Alice, Bob and Ted are incremented on a yearly basis from the year 2000 to 2009.
DISTRIBUTED ASMS • A distributed ASM (DASM) involves a collection of agents. • Global states • Move • A single computation step of an individual agent • Partially ordered runs
FROM ASM TO ASML • Block structure • Type • Class • Structure • Method • Variable
FROM ASM TO ASML • Block structure • indentation to indicate block structure • Type • Class, structure, etc. • Class • Inheritance, Overloading • Method • name( parameter1 as Type,...parametern as Type ) as Type • Variable • Set and Map
SET AND MAP VARIABLE • Set • A set is an unordered collection of distinct values that are of the same type • Map • Like arrays, maps have a set of unique keys and a set of values associated with those keys
SET AND MAP VARIABLE • Set • A set is an unordered collection of distinct values that are of the same type • Set with enumerated elements var s = {1, 2, 3, 4} • Map • Like arrays, maps have a set of unique keys and a set of values associated with those keys • Map declaration var phoneNumber as Map of String to Integer
SIMULATION OF AGENTS • Agents declaration • Class Agent Var Agents as Set of Agent = {}
SIMULATION OF AGENTS • Agents declaration • Class Agent Var Agents as Set of Agent = {} • Mailbox and InsertMessage Method • type Message Class Agent program () Var mailbox as Set of Message = {} InsertMessage( m as Message) mailbox(m) := true
SIMULATION OF AGENTS • Agents declaration • Class Agent Var Agents as Set of Agent = {} • Mailbox and InsertMessage Method • type Message Class Agent program () Var mailbox as Set of Message = {} InsertMessage( m as Message) mailbox(m) := true • RunAgents • forall a in chooseSubset(Agents) program(a)
ABSTRACT COMMUNICATION MODEL • Class COMMUNICATOR extends Agent • Class APPLICATION extends Agent
ABSTRACT COMMUNICATION MODEL • Message Transformation • Message Routing • Delivery Condition • Message Delivery
MESSAGE TRANSFORMATION • Method: ResolveMessage • Variable: addressTable
MESSAGE TRANSFORMATION • Method: ResolveMessage • type Message Class COMMUNICATOR ResoveMessage (m as MESSAGE) as Set of MESSAGE • Variable: addressTable • type Address Class COMMUNICATOR Var addressTable as Map of ADDRESS to Set of Address
MESSAGE TRANSFORMATION • Message transformation • destination (m as MESSAGE) as ADDRESS Class COMMUNICATOR Transform (m as MESSAGE, dest as ADDRESS) as MESSAGE ResolveMessage (m as MESSAGE) as Set of MESSAGE Return {Transform(m, a) | a in addressTable(destination(m))}
MESSAGE ROUTING • Recipient method • routingTable variable
MESSAGE ROUTING • Recipient method • Class COMMUNICATOR Recipient (m as MESSAGE) as Agent? • routingTable variable • Class COMMUNICATOR var routingTable as Map of Address to Agent
MESSAGE ROUTING • Recipient method • Class COMMUNICATOR Recipient (m as MESSAGE) as Agent? return routingTable (destination(m)) • routingTable variable • Class COMMUNICATOR var routingTable as Map of Address to Agent
DELIVER CONDITIONS • Predicate ReadyToDeliver • Network latency, security parameters and resource limitations, etc. • Class COMMUNICATOR external ReadyToDeliver(m as MESSAGE) as Boolean
MESSAGE DELIVERY • Class COMMUNICATOR Program() = Let availableMsgs = { m | m in me.mailbox where ReadyToDeliver(m)} Let selectedMsgs = chooseSubset (availableMsgs) forall msg in selectedMsgs me.mailbox(msg) := false //delete the message //resolve the message let resolvedMesgs = ResolveMessage (msg) forall m in resolveMesgs let a = Recipient(m) if a <> undef then //if recipient found InsertMessage(a, m) //forward the message else skip • . In order to minimize the number of colors needed for a coloring of paths for pairs of vertices in ,we can divide the path-types in groups such that the total length of the paths for path-types in a group is at most 2D and we have as few groups as possible. Here we only deal with path-types (h, v) with h > v. This implies that for any path-length L there are (L-1)/2 items to pack.
REUSE OF THE ACM • Reuse of the ACM • XLANG is a real-life application of distributed abstract machines • XLANG is an XML based formal language that can be used to define the data and networking protocols of automated business process.
SUMMARY • ASM are able to simulate every sequential algorithms in the step for step manner. • DASM involves a collection of agents. Agents may perform their computation steps concurrently with the partially ordered runs. • ASML is an industrial strength language to represent ASMs in industrial environment. • Abstract communication model is based on DASM, implemented in ASML. • The generality of the model has been confirmed by its reuse for different architectures.