Semantics of Orc William Cook and Jayadev Misra f cook,misra g - - PowerPoint PPT Presentation

semantics of orc
SMART_READER_LITE
LIVE PREVIEW

Semantics of Orc William Cook and Jayadev Misra f cook,misra g - - PowerPoint PPT Presentation

D EPARTMENT OF C OMPUTER S CIENCES Semantics of Orc William Cook and Jayadev Misra f cook,misra g @cs.utexas.edu Department of Computer Science University of Texas at Austin Email: web: http://www.cs.utexas.edu/users/psp U NIVERSITY OF T EXAS


slide-1
SLIDE 1

DEPARTMENT OF COMPUTER SCIENCES

Semantics of Orc

William Cook and Jayadev Misra Department of Computer Science University of Texas at Austin Email:

fcook,misrag@cs.utexas.edu

web: http://www.cs.utexas.edu/users/psp

UNIVERSITY OF TEXAS AT AUSTIN

slide-2
SLIDE 2

DEPARTMENT OF COMPUTER SCIENCES

Outline

Define an asynchronous semantics, using labeled transitions.

An expression transits to another expression, causing an event. Labels are events.

Refine asynchronous semantics to a synchronous semantics.

UNIVERSITY OF TEXAS AT AUSTIN 1

slide-3
SLIDE 3

DEPARTMENT OF COMPUTER SCIENCES

Formal Syntax

f ; g ; h 2 E xpr

::=

M (P )

Site call

j j E (P )

Expression call

j j f > x > g

Sequential composition

j j f j g

Symmetric composition

j j f where x:2 g

Asymmetric composition

p 2 A tual

::=

x j j j j M q 2 F
  • r
mal

::=

x j j M

UNIVERSITY OF TEXAS AT AUSTIN 2

slide-4
SLIDE 4

DEPARTMENT OF COMPUTER SCIENCES

Enhanced Syntax

Add

?u and l et( ) as two possible expressions. f ; g ; h 2 E xpr

::=

M (P )

Site call

j j E (P )

Call to definition

j j f > x > g

Sequential composition

j j f j g

Symmetric composition

j j f where x:2 g

Asymmetric composition

j j ?u

Waiting for response

j j let ( )

Ready to Publish

UNIVERSITY OF TEXAS AT AUSTIN 3

slide-5
SLIDE 5

DEPARTMENT OF COMPUTER SCIENCES

Events

There are 4 kinds of events.

l 2 E v ent

::=

M h ; u i

Site call with handle

u j j u?

Response

j j y

publish

j j
  • silent transition

Response is outside the control of Orc.

UNIVERSITY OF TEXAS AT AUSTIN 4

slide-6
SLIDE 6

DEPARTMENT OF COMPUTER SCIENCES

Rules for Site Call

u fresh M ( ) M h ;u i , ! ?u

(SITECALL)

?u u? , ! let ( )

(SITERET)

let ( ) y , !

(LET)

UNIVERSITY OF TEXAS AT AUSTIN 5

slide-7
SLIDE 7

DEPARTMENT OF COMPUTER SCIENCES

Symmetric Composition

f l , ! f f j g l , ! f j g

(SYM1)

g l , ! g f j g l , ! f j g

(SYM2)

UNIVERSITY OF TEXAS AT AUSTIN 6

slide-8
SLIDE 8

DEPARTMENT OF COMPUTER SCIENCES

Sequencing

f l , ! f l 6= y f > x > g l , ! f > x > g

(SEQ1N)

f y , ! f f > x > g
  • ,
! (f > x > g ) j [ =x℄g

(SEQ1V)

UNIVERSITY OF TEXAS AT AUSTIN 7

slide-9
SLIDE 9

DEPARTMENT OF COMPUTER SCIENCES

Asymmetric Composition

f l , ! f l 6= y g where x:2 f l , ! g where x:2 f

(ASYM1N)

f y , ! f g where x:2 f
  • ,
! [ =x℄g

(ASYM1V)

g l , ! g g where x:2 f l , ! g where x:2 f

(ASYM2)

UNIVERSITY OF TEXAS AT AUSTIN 8

slide-10
SLIDE 10

DEPARTMENT OF COMPUTER SCIENCES

Expression Call

[[ E (q )
  • f
℄℄ 2 D E (p)
  • ,
! [p=q ℄f

(DEF)

UNIVERSITY OF TEXAS AT AUSTIN 9

slide-11
SLIDE 11

DEPARTMENT OF COMPUTER SCIENCES

Rules

UNIVERSITY OF TEXAS AT AUSTIN 10

slide-12
SLIDE 12

DEPARTMENT OF COMPUTER SCIENCES

u fresh M ( ) M h ;u i , ! ?u ?u u? , ! let ( ) let ( ) y , ! f l , ! f f j g l , ! f j g g l , ! g f j g l , ! f j g [[ E (q )
  • f
℄℄ 2 D E (p)
  • ,
! [p=q ℄f f l , ! f l 6= y f > x > g l , ! f > x > g f y , ! f f > x > g
  • ,
! (f > x > g ) j [ =x℄g f l , ! f l 6= y g where x:2 f l , ! g where x:2 f f y , ! f g where x:2 f
  • ,
! [ =x℄g g l , ! g g where x:2 f l , ! g where x:2 f

UNIVERSITY OF TEXAS AT AUSTIN 11

slide-13
SLIDE 13

DEPARTMENT OF COMPUTER SCIENCES

Pending Event

At any moment, there is a set of pending events. Processing a pending event may

transform the expression, change the set of pending events.

UNIVERSITY OF TEXAS AT AUSTIN 12

slide-14
SLIDE 14

DEPARTMENT OF COMPUTER SCIENCES

Example of Event Processing

In

M (x) where x:2 N j R, both N hui and R hv i are pending. M (x) where x:2 N j R N hui , ! M (x) where x:2 ?u j R R hv i is still pending. So are u?x, for all x.

After

M (x) where x:2 ?u j R u? , ! M ( ) R hv i and u?x are no longer pending.

UNIVERSITY OF TEXAS AT AUSTIN 13

slide-15
SLIDE 15

DEPARTMENT OF COMPUTER SCIENCES

Rules for Event Processing

(Fairness) If there is an internal pending event, some pending event is

processed eventually.

(Asynchrony) Order and timing of event processings are arbitrary.

UNIVERSITY OF TEXAS AT AUSTIN 14

slide-16
SLIDE 16

DEPARTMENT OF COMPUTER SCIENCES

Notes on Event Processing

Fairness is minimal progress. It does not say that:

an event which remains pending is eventually processed.

Only internal events are under client’s control. If there are only external pending events, no event may be processed.

UNIVERSITY OF TEXAS AT AUSTIN 15

slide-17
SLIDE 17

DEPARTMENT OF COMPUTER SCIENCES

Examples

  • let
(x) where x:2 let (0) j R timer (1)
  • R

If it publishes 0,

R’s response, if any, is never fully processed. (Fairness) Metr
  • nome
  • (l
et(0) j l et(1))

May publish 0 forever.

(Asynchrony) let (x) where x:2 let (0) j R timer (1)
  • l
et(1)

may publish 0 or 1.

UNIVERSITY OF TEXAS AT AUSTIN 16

slide-18
SLIDE 18

DEPARTMENT OF COMPUTER SCIENCES

Synchronous Semantics

Specify time (and order) of event processing. Internal event (action):

l 2 A tion

::=

M h ; ui

Site call with handle

u j j y

publish;

l et( ) is internal j j
  • silent transition

External Event (response):

u?

Rule 1: Process a response only if there is no action. Order among internal events is arbitrary. Order among external responses is arbitrary.

UNIVERSITY OF TEXAS AT AUSTIN 17

slide-19
SLIDE 19

DEPARTMENT OF COMPUTER SCIENCES

Examples

let (x) where x:2 let (0) j R timer (1)
  • l
et(1)

(1)

let (x) where x:2 let (0) j let (2) j R timer (1)
  • l
et(1)

(2)

let (x) where x:2 if (true )
  • let
(0) j R timer (1)
  • l
et(1)

(3)

let (x) where x:2 R timer (1)
  • let
(0) j R timer (2)
  • l
et(1)

(4) (1) publishes 0. (2) publishes 0 or 2. (3) publishes 0 or 1. (4) publishes 0 or 1.

UNIVERSITY OF TEXAS AT AUSTIN 18

slide-20
SLIDE 20

DEPARTMENT OF COMPUTER SCIENCES

Handle Time

Rule 2: Process events as soon as possible. Assume event processing is instantaneous.

let (x) where x:2 R timer (1)
  • let
(0) j R timer (2)
  • l
et(1)

(4) publishes 0.

UNIVERSITY OF TEXAS AT AUSTIN 19

slide-21
SLIDE 21

DEPARTMENT OF COMPUTER SCIENCES

Immediate/deferred Sites

Designate certain sites as immediate, rest as deferred. An immediate site has to respond instantaneously. Immediate Sites:

let , if , add,
  • r,
  • Deferred Sites:
R timer, CNN
  • Rule 3: A response from an immediate site is an internal event.
let (x) where x:2 if (true )
  • let
(0) j R timer (1)
  • l
et(1)

(3) publishes 0.

UNIVERSITY OF TEXAS AT AUSTIN 20

slide-22
SLIDE 22

DEPARTMENT OF COMPUTER SCIENCES

Positive/Negative Response

An immediate site responds immediately with

positive response: a result value, written as u? , or negative response: that it will be silent, written as u?? ?u u?? , !

(SITERET)

UNIVERSITY OF TEXAS AT AUSTIN 21

slide-23
SLIDE 23

DEPARTMENT OF COMPUTER SCIENCES

Summary of Rules for Synchronous Semantics

Process a response only if there is no action. Process events as soon as possible. A response from an immediate site is an internal event.

UNIVERSITY OF TEXAS AT AUSTIN 22

slide-24
SLIDE 24

DEPARTMENT OF COMPUTER SCIENCES

Formal definition of Synchronous Semantics

Define quiescent expression, QE xpr, one that has no internal event. Define non-quiescent expression, NExpr , its complement. , ! : Expr
  • Event
  • Expr
fDefined earlier g r , !R : QExpr
  • R
esp
  • nse
  • Expr
= f(q ; r ; e) j q r , ! eg a , !A : NExpr
  • A
tion
  • Expr
= f( ^ q ; a; e) j ^ q a , ! eg l , !S : Expr
  • Event
  • Expr
= l , !R [ l , !A

UNIVERSITY OF TEXAS AT AUSTIN 23

slide-25
SLIDE 25

DEPARTMENT OF COMPUTER SCIENCES

Round-based Execution

A round consists of processing internal events. This includes calls to

and responses from immediate sites.

A round ends when no more internal events can be processed. First round starts at the beginning of evaluation. Subsequent rounds start by processing a response from a deferred

site.

UNIVERSITY OF TEXAS AT AUSTIN 24

slide-26
SLIDE 26

DEPARTMENT OF COMPUTER SCIENCES

Laws of Kleene Algebra

(Zero and

j ) f j = f

(Commutativity of

j ) f j g = g j f

(Associativity of

j ) (f j g ) j h = f j (g j h)

(Idempotence of

j ) f j f = f

(Associativity of

) (f
  • g
)
  • h
= f
  • (g
  • h)

(Left zero of

)
  • f
=

(Right zero of

) f
  • =

(Left unit of

) S ig nal
  • f
= f

(Right unit of

) f > x > let (x) = f

(Left Distributivity of

  • ver
j ) f
  • (g
j h) = (f
  • g
) j (f
  • h)

(Right Distributivity of

  • ver
j ) (f j g )
  • h
= (f
  • h
j g
  • h)

UNIVERSITY OF TEXAS AT AUSTIN 25

slide-27
SLIDE 27

DEPARTMENT OF COMPUTER SCIENCES

Laws which do not hold

(Idempotence of

j ) f j f = f

(Right zero of

) f
  • =

(Left Distributivity of

  • ver
j ) f
  • (g
j h) = (f
  • g
) j (f
  • h)

UNIVERSITY OF TEXAS AT AUSTIN 26

slide-28
SLIDE 28

DEPARTMENT OF COMPUTER SCIENCES

Additional Laws

(Distributivity over

)

if

g is x-free (f
  • g
where x:2 h) = (f where x:2 h)
  • g

(Distributivity over

j )

if

g is x-free (f j g where x:2 h) = (f where x:2 h) j g

(Distributivity over where ) if

g is y-free ((f where x:2 g ) where y :2 h) = ((f where y :2 h) where x:2 g )

(Elimination of where) if

f is x-free, for site M (f where x:2 M ) = f j M
  • UNIVERSITY OF TEXAS AT AUSTIN

27

slide-29
SLIDE 29

DEPARTMENT OF COMPUTER SCIENCES

Silent Expression

g is silent if it never publishes: g = g
  • 0.
f nx: In f replace site calls which have x as a parameter by 0.

Law: If

g is silent, then (f where x:2 g ) = (f nx j g )

Exercise:: Explore identities about silent expressions.

UNIVERSITY OF TEXAS AT AUSTIN 28

slide-30
SLIDE 30

DEPARTMENT OF COMPUTER SCIENCES

Proofs

Direct proofs from the asynchronous semantics of:

– Zero and

j

– Commutativity of

j

– Left zero of

  • Others: Bisimulations using safe functions and parallel composition

contexts (see Sangiorgi and Walker). Proofs employ asynchronous semantics. No proof yet using the synchronous semantics.

UNIVERSITY OF TEXAS AT AUSTIN 29

slide-31
SLIDE 31

DEPARTMENT OF COMPUTER SCIENCES

References

Operational Semantics + Bisimulation; see (with William Cook) http://www.cs.utexas.edu/users/wcook/projects/orc/papers/OrcCookMisra05.pdf A Denotational Semantics; see (with Tony Hoare and Galen Menzel) http://www.cs.utexas.edu/users/psp/Semantics.Orc.pdf A tutorial on the model with longer examples; see (with William Cook) http://www.cs.utexas.edu/users/wcook/papers/OrcJSSM05/OrcJSSM.pdf

UNIVERSITY OF TEXAS AT AUSTIN 30