Title: Exercice: Alternated Bit Protocol Correction 1:
1Exercice Alternated Bit Protocol Correction (1)
Channels that loose and duplicate messages (in0
and in1) but preserve their order ? 1) Draw an
automaton describing the loosy channel behaviour
- It is a symmetric system, receiving ?in0 and
?in1 messages, then delivering 0 , 1 or more
times the corresponding !out0 or !out1 message. - On each side (bit 0 or 1), the initial state has
a single transition for the reception. - In the next state, it can either return
silently to the initial state ( lose the
message), deliver the message and return to the
initial state (exactly one delivery), or deliver
the message and stay in the same state (thus
enabling duplication).
2Exercice Alternated Bit Protocol Correction (2)
Channels that loose and duplicate messages (in0
and in1) but preserve their order ? 2) Write it
in CCS
- let rec ch0 ?in0 ch1 ?in1ch2
- and ch1 ? ch1 ? ch0 !out0
ch1 !out0 ch0 - and ch2 ? ch2 ? ch0 !out0
ch2 !out0 ch0 -
- in ch0
3Exercice Alternated Bit Protocol Correction (3)
?in0
Channels that loose and duplicate messages (in0
and in1) but preserve their order ? Other
Solutions More generally, parameterized model
?
!out0
!out0
?in0
?
!out0
?
?
!out0
?in1
?in0
4Exercice 2 Bisimulations
- Are those 3 LTSs equivalent by
- Strong bisimulation?
- Weak bisimulation ?
- In each case, give a proof.
?in0
?
!out0
!out0
?in0
?
!out0
?
?
!out0
?in1
?in0
5Exercice 2 Bisimulations
- Are those 3 LTSs equivalent by
- Strong bisimulation?
- NO ! Need find non equivalent states. E.g.
counter example for 1 ? 2 - States 1.0 and 1.1 are different because 1.0 can
do ?in0 and 1.1 cannot. - Then 1.1 and 2.1 are different because 1.1 can do
!out0 -gt 1.0, while no 2.1 !out0 transitions can
go to a state equivalent to 1.0. - Weak bisimulation ?
- YES. Exhibit a partition of equivalent states
- 11.0,2.0, 21.1, 2.1
- Check all possible (?a?) transitions
- 1 - !in0 -gt 2, , 2 - !out0.? -gt 1
- Remark this transition set defines the minimal
representant modulo weak bisimulation
?in0
?
1.1
!out0
1.0
!out0
?in0
?
2.1
2.0
!out0
?
?
!out0
?in1
?in0
6Exercice 3 Produit synchronisé
Compute the synchronized product of the LTS
representing the ABP emitter with the (forward)
Channel local in0, in1 in (Emitter
Channel)
0
1
2
3
1
2
0
7Exercice 3 Produit synchroniséCorrection ?
partially
local in0, in1 in (Emitter Channel)
!out0
?
?
?imss
?ack1
?
!out0
0,0
1,0
1,1
?ack0
?ack0
?
?ack1
2,1
?
2,0
!out0
!out0
?ack0
!in1
?
3,0
3,1
?imss
?imss
?
!out1
8Exercice 3 Produit synchroniséCorrection ?
Tool generated LTS
9Exercice 3 Draw the (body) Behaviour of a
philosopher, using a parameterized LTS
public class Philosopher implements Active
protected int id public void runActivity
(Body myBody) while (true) switch
(State) case 0 think() break
case 1 getForks() break case 2 eat()
break case 3 putForks() break
public void getForks()
ProActive.waitFor(ForkrightForkIndex.take())
ProActive.waitFor(ForkleftForkIndex.take())
State2 ../..
10Exercice 3 Draw the (body) Behaviour of a
philosopher, using a parameterized LTS
public class Philosopher implements Active
protected int id public void runActivity
(Body myBody) while (true) switch
(State) case 0 think() break
case 1 getForks() break case 2 eat()
break case 3 putForks() break
public void getForks()
ProActive.waitFor(ForkrightForkIndex.take())
ProActive.waitFor(ForkleftForkIndex.take())
State2 ../..
Think(n)
!Q_drop(n1)
!Q_take(n)
!Q_drop(n)
!Q_take(n1)
Eat(n)
Note is supposed modulo k First try Wrong !
It is not enough to send the Take requests, it is
necessary to wait for their execution
11Exercice 3 Draw the (body) Behaviour of a
philosopher, using a parameterized LTS
public class Philosopher implements Active
protected int id public void runActivity
(Body myBody) while (true) switch
(State) case 0 think() break
case 1 getForks() break case 2 eat()
break case 3 putForks() break
public void getForks()
ProActive.waitFor(ForkrightForkIndex.take())
ProActive.waitFor(ForkleftForkIndex.take())
State2 ../..
Think(n)
!Q_drop(n1)
!Q_take(n)
?R_take(n)
!Q_drop(n)
!Q_take(n1)
?R_take(n1)
Eat(n)
Second try Better ! Remark that drop needs no
synchronization. But maybe we could do better,
and relax the sequential order?
12Exercice 3 Draw the (body) Behaviour of a
philosopher, using a parameterized LTS
Philo(n)
!Q_take(n)
Body
Think(n)
!Q_drop(n1)
!Q_take(n)
!Q_drop(n)
!Q_take(n1)
?R_take(n)
?Use_take(n)
?Use_take(n)
Eat(n)
?Use_take(n1)
Build one Future Proxy for each remote call in
the source code. Synchronize at the first use
point in the code (Wait by necessity).