View
219
Download
0
Embed Size (px)
Citation preview
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.
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 sequenceX0, X1, X2,……. Where X0 is an initial stateand 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
S1
mode = "Initial"orders = 0
balance = $0
S2
mode = "Active"orders = 2
balance = $200
S3
mode = "Final"orders = 0
balance = $500
Initialize ProcessAll
Orders
THE RUN OF ASM
balance
orders
mode
$0
0
"Initial"
The Machine'sControl Logic
balance
orders
mode
$200
2
"Active"
input
output
...if mode = "Initial"then mode := "Active"...
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.
S1 S2 S3
. . .Alice.age = 20Bob.age = 16Ted.age = 40
Alice.age = 21Bob.age = 17Ted.age = 41
Alice.age = 22Bob.age = 18Ted.age = 42
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
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 = {}
Mailbox and InsertMessage Method type Message
Class Agentprogram ()
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 Agentprogram ()
Var mailbox as Set of Message = {} InsertMessage( m as Message) mailbox(m) := true
RunAgents forall a in chooseSubset(Agents) program(a)
ABSTRACT COMMUNICATION MODEL
Message Transformation Message Routing Delivery Condition Message Delivery
MESSAGE TRANSFORMATION
Method: ResolveMessage type Message
Class COMMUNICATORResoveMessage (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 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 COMMUNICATORRecipient (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 COMMUNICATORexternal 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.