COMP31212: Concurrency Topics 2.3: Understanding FSP Topic 2.3: - - PowerPoint PPT Presentation

comp31212 concurrency
SMART_READER_LITE
LIVE PREVIEW

COMP31212: Concurrency Topics 2.3: Understanding FSP Topic 2.3: - - PowerPoint PPT Presentation

Topic 2.3: Understanding FSP COMP31212: Concurrency Topics 2.3: Understanding FSP Topic 2.3: Understanding FSP Outline Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition


slide-1
SLIDE 1

Topic 2.3: Understanding FSP

COMP31212: Concurrency

Topics 2.3: Understanding FSP

slide-2
SLIDE 2

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-3
SLIDE 3

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-4
SLIDE 4

Topic 2.3: Understanding FSP

Transition Relation

  • An FSP process can make a labelled transition into a new

FSP process.

  • Each FSP process has a corresponding LTS
  • FSP process transition determines state transition in LTS
  • A transition path E

a1

→ E1

a2

→ · · · an → En . . . determines the nodes and edges traversed in the LTS for E. How to find LTS: define Transition Relation Rules for each FSP construct

slide-5
SLIDE 5

Topic 2.3: Understanding FSP

Transition Rules

Transition Relation: σ ⊆ (Proc × Act × Proc) where

  • Proc is the set of FSP process terms
  • Act is the set of action labels, together with tau.
slide-6
SLIDE 6

Topic 2.3: Understanding FSP

Transition Rules

Transition Relation: σ ⊆ (Proc × Act × Proc) where

  • Proc is the set of FSP process terms
  • Act is the set of action labels, together with tau.

General Format of Transition Rule: premisses

RuleName

transition Premisses may be transitions (built via transition rules) or other conditions Transition P

a

→ P′ means that (P, a, P′) ∈ σ

slide-7
SLIDE 7

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-8
SLIDE 8

Topic 2.3: Understanding FSP

Prefix and Definition Rules

Prefix Action Rule:

Prefix (a->P)

a

→ P

slide-9
SLIDE 9

Topic 2.3: Understanding FSP

Prefix and Definition Rules

Prefix Action Rule:

Prefix (a->P)

a

→ P

Definition Rule:

P

a

→ P′ Defn ProcId

a

→ P′ where (ProcId = P)

slide-10
SLIDE 10

Topic 2.3: Understanding FSP

Prefix and Definition Rules

Prefix Action Rule:

Prefix (a->P)

a

→ P

Definition Rule:

P

a

→ P′ Defn ProcId

a

→ P′ where (ProcId = P)

e.g. SWITCH = (on -> (off -> STOP)).

slide-11
SLIDE 11

Topic 2.3: Understanding FSP

Prefix and Definition Rules

Prefix Action Rule:

Prefix (a->P)

a

→ P

Definition Rule:

P

a

→ P′ Defn ProcId

a

→ P′ where (ProcId = P)

e.g. SWITCH = (on -> (off -> STOP)). ⋆ Calculate Transitions? ⋆

slide-12
SLIDE 12

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-13
SLIDE 13

Topic 2.3: Understanding FSP

Choice Rule

for some i ∈ {1, . . . , n} Choice (a1->P1 | · · · | an->Pn)

ai

→ Pi

slide-14
SLIDE 14

Topic 2.3: Understanding FSP

Choice Rule

for some i ∈ {1, . . . , n} Choice (a1->P1 | · · · | an->Pn)

ai

→ Pi

Example:

COIN = (toss->HEADS | toss->TAILS), HEADS = (heads->COIN), TAILS = (tails->COIN).

Transitions:

COIN

toss

→ HEADS

heads

→ COIN and COIN

toss

→ TAILS

tails

→ COIN

⋆ Calculate Transition Relation? ⋆

slide-15
SLIDE 15

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-16
SLIDE 16

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P)

slide-17
SLIDE 17

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn)

slide-18
SLIDE 18

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn)

slide-19
SLIDE 19

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P)

slide-20
SLIDE 20

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P) Extension: α(P + {a1, . . . , an}) = α(P) ∪ {a1, . . . , an}

slide-21
SLIDE 21

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P) Extension: α(P + {a1, . . . , an}) = α(P) ∪ {a1, . . . , an} Hiding: α(P\{a1, . . . , an}) = α(P) − {a1, . . . , an}

slide-22
SLIDE 22

Topic 2.3: Understanding FSP

Parallel Rules I: Alphabets

  • First. . . Alphabet: α(P) ⊆ L:

Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P) Extension: α(P + {a1, . . . , an}) = α(P) ∪ {a1, . . . , an} Hiding: α(P\{a1, . . . , an}) = α(P) − {a1, . . . , an} Stop: α(STOP) = { }

slide-23
SLIDE 23

Topic 2.3: Understanding FSP

Example

LAUGH = (laugh -> STOP). CONVERSE = (think -> TALK), TALK = (talk

  • > STOP).

||LAUGH_CONVERSE = (LAUGH || CONVERSE).

slide-24
SLIDE 24

Topic 2.3: Understanding FSP

Example

LAUGH = (laugh -> STOP). CONVERSE = (think -> TALK), TALK = (talk

  • > STOP).

||LAUGH_CONVERSE = (LAUGH || CONVERSE). ⋆ Calculate alphabet: α(LAUGH CONVERSE)? ⋆

slide-25
SLIDE 25

Topic 2.3: Understanding FSP

Parallel Rules II: Definition

P

a

→ P′ a ∈ α(Q)

Par1

(P||Q)

a

→ (P′||Q)

slide-26
SLIDE 26

Topic 2.3: Understanding FSP

Parallel Rules II: Definition

P

a

→ P′ a ∈ α(Q)

Par1

(P||Q)

a

→ (P′||Q) Q

b

→ Q′ b ∈ α(P)

Par2

(P||Q) b → (P||Q′)

slide-27
SLIDE 27

Topic 2.3: Understanding FSP

Parallel Rules II: Definition

P

a

→ P′ a ∈ α(Q)

Par1

(P||Q)

a

→ (P′||Q) Q

b

→ Q′ b ∈ α(P)

Par2

(P||Q) b → (P||Q′) P

a

→ P′ Q

a

→ Q′

Par3

(P||Q)

a

→ (P′||Q′)

slide-28
SLIDE 28

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Defn

LAUGH CONVERSE

slide-29
SLIDE 29

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Par1

(LAUGH || CONVERSE)

Defn

LAUGH CONVERSE

slide-30
SLIDE 30

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Defn

LAUGH

Par1

(LAUGH || CONVERSE)

Defn

LAUGH CONVERSE

slide-31
SLIDE 31

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Prefix

(laugh->STOP)

Defn

LAUGH

Par1

(LAUGH || CONVERSE)

Defn

LAUGH CONVERSE

slide-32
SLIDE 32

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Prefix

(laugh->STOP)

laugh

→ STOP

Defn

LAUGH

Par1

(LAUGH || CONVERSE)

Defn

LAUGH CONVERSE

slide-33
SLIDE 33

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Prefix

(laugh->STOP)

laugh

→ STOP

Defn

LAUGH

laugh

→ STOP

Par1

(LAUGH || CONVERSE)

Defn

LAUGH CONVERSE

slide-34
SLIDE 34

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Prefix

(laugh->STOP)

laugh

→ STOP

Defn

LAUGH

laugh

→ STOP

Par1

(LAUGH || CONVERSE)

laugh

→ (STOP||CONVERSE)

Defn

LAUGH CONVERSE

slide-35
SLIDE 35

Topic 2.3: Understanding FSP

An Example Transition Derivation

Consider the LAUGH CONVERSE process ...

Prefix

(laugh->STOP)

laugh

→ STOP

Defn

LAUGH

laugh

→ STOP

Par1

(LAUGH || CONVERSE)

laugh

→ (STOP||CONVERSE)

Defn

LAUGH CONVERSE

laugh

→ (STOP||CONVERSE)

slide-36
SLIDE 36

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

slide-37
SLIDE 37

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK)

slide-38
SLIDE 38

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP)

slide-39
SLIDE 39

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSE

slide-40
SLIDE 40

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)

slide-41
SLIDE 41

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)

laugh

→ (STOP || TALK)

slide-42
SLIDE 42

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)

laugh

→ (STOP || TALK)talk → (STOP || STOP)

slide-43
SLIDE 43

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)

laugh

→ (STOP || TALK)talk → (STOP || STOP) (LAUGH || TALK)

slide-44
SLIDE 44

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)

laugh

→ (STOP || TALK)talk → (STOP || STOP) (LAUGH || TALK)talk → (LAUGH || STOP)

slide-45
SLIDE 45

Topic 2.3: Understanding FSP

For you to consider ...

⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE

laugh

→ (STOP || CONVERSE)

think

→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)

laugh

→ (STOP || TALK)talk → (STOP || STOP) (LAUGH || TALK)talk → (LAUGH || STOP)

laugh

→ (STOP || STOP)

slide-46
SLIDE 46

Topic 2.3: Understanding FSP

Some diagrams ...

LAUGH

2 states ✒✑ ✓✏ ✒✑ ✓✏

1

laugh ◮ CONVERSE

3 states ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏

1 2

think ◮ talk ◮

slide-47
SLIDE 47

Topic 2.3: Understanding FSP

Some diagrams ...

LAUGH

2 states ✒✑ ✓✏ ✒✑ ✓✏

1

laugh ◮ CONVERSE

3 states ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏

1 2

think ◮ talk ◮ CONVERSE LAUGH

2 × 3 states ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏

1 2 3 4 5

laugh ◮ laugh ◮ laugh ◮ think ◮ talk ◮ talk ◭ think ◭

slide-48
SLIDE 48

Topic 2.3: Understanding FSP

The states of CONVERSE LAUGH

state 0: (LAUGH || CONVERSE) state 1: (LAUGH || TALK) state 2: (LAUGH || STOP) state 3: (STOP || STOP) state 4: (STOP || TALK) state 5: (STOP || CONVERSE)

slide-49
SLIDE 49

Topic 2.3: Understanding FSP

Another Version

CONVERSE LAUGHv2 = (laugh->think->TALK | think->laugh->TALK | think->talk->laugh->STOP ), TALK = (talk->STOP) ⋆ Calculate transitions? ⋆

slide-50
SLIDE 50

Topic 2.3: Understanding FSP

An example with interaction

MKR = (make->M), M = (rdy->MKR). USER = (rdy->U), U = (use->USER). || MKR USER = (MKR || USER). (MKR || USER) make → (M || USER)

rdy

→ (MKR || U) use → (MKR || USER) ⋆ Build Transitions? ⋆ ⋆ Transition Relation? ⋆

slide-51
SLIDE 51

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER)

slide-52
SLIDE 52

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER)

(M||USER)

slide-53
SLIDE 53

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER)

M USER

Par3

(M||USER)

slide-54
SLIDE 54

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER)

(rdy->MKR)

Defn

M USER

Par3

(M||USER)

slide-55
SLIDE 55

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER) Prefix

(rdy->MKR)

rdy

→ MKR

Defn

M USER

Par3

(M||USER)

slide-56
SLIDE 56

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER) Prefix

(rdy->MKR)

rdy

→ MKR

Defn

M

rdy

→ MKR USER

Par3

(M||USER)

slide-57
SLIDE 57

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER) Prefix

(rdy->MKR)

rdy

→ MKR

Defn

M

rdy

→ MKR (rdy->U)

Defn

USER

Par3

(M||USER)

slide-58
SLIDE 58

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER) Prefix

(rdy->MKR)

rdy

→ MKR

Defn

M

rdy

→ MKR

Prefix

(rdy->U)

rdy

→ U

Defn

USER

Par3

(M||USER)

slide-59
SLIDE 59

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER) Prefix

(rdy->MKR)

rdy

→ MKR

Defn

M

rdy

→ MKR

Prefix

(rdy->U)

rdy

→ U

Defn

USER

rdy

→ U

Par3

(M||USER)

slide-60
SLIDE 60

Topic 2.3: Understanding FSP

Example Transition Derivation for MKR

(calculate as before) Defn ||MAKER USER

make

→ (M||USER) Prefix

(rdy->MKR)

rdy

→ MKR

Defn

M

rdy

→ MKR

Prefix

(rdy->U)

rdy

→ U

Defn

USER

rdy

→ U

Par3

(M||USER)

rdy

→ (MKR||U)

slide-61
SLIDE 61

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-62
SLIDE 62

Topic 2.3: Understanding FSP

Generating LTS

For FSP process P, what is its LTS?: LTSP = (S, A, σ, s0) where S : set of states S ⊆ Proc A : alphabet A ⊆ Act σ : transition relation σ ⊆ (S × A × S) s0 initial state s0 ∈ S

slide-63
SLIDE 63

Topic 2.3: Understanding FSP

To find LTS for FSP process P:

  • 1. calculate transition relation σ using Transition Rules:

σ = {(s1, a1, s′

1), . . . , (sn, an, s′ n)}

  • 2. States: S =

n

  • i=1

{si} ∪ {s′

i}

  • 3. Starting state: s0 = P
  • 4. Alphabet: A = α(P)

* Example of this construction – above *

slide-64
SLIDE 64

Topic 2.3: Understanding FSP

Outline

Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules

slide-65
SLIDE 65

Topic 2.3: Understanding FSP

Remaining rules

Generalised Choice for some i ∈ {1, . . . , n} : bi = true Choice (when b1 a1->P1 | · · · | when bn an->Pn)

ai

→ Pi Process Labelling P

b

→ P′ ProcLabel1 a : P

a.b

→ a : P′ a ∈ A P

b

→ P′ ProcLabel2 A :: P

a.b

→ A :: P′ i ∈ {1, . . . , n} and P

bi

→ P′ ReLabel P/{a1/b1, . . . , an/bn}

ai

→ P′/{a1/b1, . . . , an/bn}

slide-66
SLIDE 66

Topic 2.3: Understanding FSP

And some more ...

Hiding Rules P

b

→ P′ and b ∈ A

Hide1

P\A b → P′\A P

b

→ P′ and b ∈ A

Hide2

P\A tau → P′\A P

b

→ P′ and b ∈ A

Hide3

P@A b → P′@A P

b

→ P′ and b ∈ A

Hide4

P@A tau → P′@A