240 likes | 388 Views
A Timed Mobility Semantics based on Rewriting Strategies Jason Steggles Newcastle University. Gabriel Ciobanu A. I. Cuza University of Iasi. Maciej Koutny Newcastle University. Overview. Motivation. TiMo – A Timed Mobility Process Algebra. Rewriting Logic and Strategies.
E N D
A Timed Mobility Semantics based on Rewriting Strategies Jason Steggles Newcastle University Gabriel Ciobanu A. I. Cuza University of Iasi MaciejKoutny Newcastle University
Overview • Motivation. • TiMo – A Timed Mobility Process Algebra. • Rewriting Logic and Strategies. • A Rewriting Semantics for TiMo: • Basic Idea. • Use of Strategies. • Correctness. • Simple Case Study with Elan. • Concluding Remarks.
Motivation • TiMo is a process algebra supporting mobility and time constraints. • Range of interesting theoretical results exist for TiMo. • However, currently TiMo lacks tool support resulting in few case studies. Solution • Develop a Rewriting Logic semantics. • Use strategies to capture maximal parallel computational step in TiMo. • Use Elan to develop prototype analysis tool.
Basic Idea behind TiMo locations + mobility + interaction + timers Formalism for modelling distributed systems with time-related aspects. Simple process algebra: Local interaction (communication). Interaction is not delayed. Migration with bounded delay Discrete time semantics + maximal concurrency
Mobility Example ] ] ] ] ] ] ] ] ] ] ] ] [ [ [ [ [ [ [ [ [ [ [ [ LocA 1 2 0 goΔ2LocB then P goΔ1LocB then P P LocA goΔ1LocB then P |... |LocB ... LocA goΔ2LocB then P |... |LocB ... LocB 0 P LocA ... |LocB P | ...
Communication Example ] ] ] ] [ [ [ [ LocA aΔ2?(l) then P1 else P2 | aΔ3!<LocB> then Q1 else Q2 LocA 0 1 aΔ2?(l) then P1 else P2 {LocB/l}P1 Q1 aΔ3!(LocB) then Q1 else Q2 LocA {LocB/l}P1 | Q1
Simple Workflow Example ] ] ] ] [ [ [ [ Done job Init Web job job Err job≡aΔ1?(l:loc)thengoΔ1lthenjobelsejob srv(l:loc)≡aΔ2!<l>thensrv(l)elsesrv(l) Init job|srv(Web) |Web srv(Done)
Rules for Operational Semantics ] ] ] ] ] ] ] ] [ [ [ [ [ [ [ [ (Move) L1 goΔtL2 then P L2 ⃝P S ⃝ Stall symbol S L1 aΔt1?(l)thenP1elseP2| aΔt2!<L2>thenQ1elseQ2 (Com) L1 ⃝{L2/l}P1|⃝Q1 S S
Rules for Operational Semantics ] ] ] ] ] ] ] ] ] ] ] ] [ [ [ [ [ [ [ [ [ [ [ [ L1 P1...LkPk Li (Time) ( ) L1 P1...LkPk L1 P1...LkPk Li • Contains a negative premise (no rules applicable in given location). • Use to apply clock tick and enforce timeout. • Derivation is a maximal parallel step for a location: Li 1 2 k N1 N2 ...Nk (Nk) N1 (Nk) Li Li
Rewriting Logic (RL) Sorts Ent, MSet; Subsort Ent < MSet; Ops a,b,c : Ent; @@ : MSet MSet MSet Eqs xy = yx; x(yz) = (xy)z [r1] ab ac [r2] bb c [r3] ac c r1 r1 r3 abb acb acc cc States of system defined by equational specification: Dynamic transitions defined by rewrite rules: Example:
Rewriting Logic (RL) abb r2 r1 ac [r1] ab ac [r2] bb c [r3] ac c acb r1 r3 r3 acc c cb r3 cc • Control application of rules using strategies. • For example, Elan has a strategy language.
Rewriting Strategies abb r2 r1 ac [r1] ab ac [r2] bb c [r3] ac c acb r1 r3 r3 acc cb c r3 cc r1 Strategy: dc(r1,r2,r3)
Rewriting Strategies abb r2 r1 ac [r1] ab ac [r2] bb c [r3] ac c acb r1 r3 r3 acc cb c r3 cc Strategy: dk(r1,r2,r3)
Rewriting Strategies abb r2 r1 ac [r1] ab ac [r2] bb c [r3] ac c acb r1 r3 r3 acc c cb r3 cc Strategy: repeat*dk(r1,r2,r3)
Rewriting Strategies abb r2 r1 ac [r1] ab ac [r2] bb c [r3] ac c acb r1 r3 r3 acc cb c r3 cc Strategy: repeat*first(r1,r2,r3)
RL Model for TiMo [AC] @|@ : Prs Prs Prs go(@,@) then @ : Time Loc Prs Prs in(@,@)(@) then @ else @ : Chan Time Loc Prs Prs Prs @[@] : Loc Prs Net @|@ : Net Net Net [AC] Define RL terms to model TiMo processes:
Modelling Semantic Rules ] ] ] ] [ [ [ [ (Move) L1 goΔtL2 then P L2 ⃝P S [Move] L1[go(t,L2) then P | P2] L1[P2] | L2[S(P)] [Move] L1[go(t,L2) then P | P2] L1[S(go(t-1,L2) then P)|P2] if t>0
Modelling Semantic Rules ] ] ] ] [ [ [ [ (Com) L ⃝{L2/l}P1|⃝Q1 S S L1 aΔt1?(l)thenP1elseP2| aΔt2!<L2>thenQ1elseQ2 [Com] L1[in(a,t1)(l) then P1 else P2 | out(a,t2)<L2> then Q1 else Q2 | P3] L1[S({L2/l}P1) | S(Q1) | P3]
Modelling Derivation Step step ⇒ repeat*dc(Move,Com,Calls) tick(S(P)) P tick(P1 | P2) tick(P1) | tick(P2) tick(in(a,0)(l) then P1 else P2) P2 tick(in(a,t)(l) then P1 else P2) in(a,t-1)(l) then P1 else P2 if t>0 ... Formulate a strategy for maximal parallel step: Define function to model clock tick and timeout:
Modelling Derivation Step [derStep] l[P]|N1 N3|N1 where N2 := (step) l[P] N3 := () tick(N2) Formulate a strategy for derivation step:
Correctness of RL Model • Define bijective mapping from processes to RL terms: • Correctness: : WellFormed(TM) Valid(RL) 1) Soundness 2) Completeness derStep N1 N2 T2 T1 -1 -1 T1 T2 N2 N1 derStep
Simple Workflow Example ] ] ] ] [ [ [ [ Done job Init Web job job Err job≡aΔ1?(l:loc)thengoΔ1lthenjobelsejob srv(l:loc)≡aΔ2!<l>thensrv(l)elsesrv(l) Init job|srv(Web) |Web srv(Done) Use Elan to simulate and analyse RL model:
Simple Workflow Example ] ] ] ] [ [ [ [ Done Init Web Err srvE(Err) srvE(l:loc)≡aΔ2!<l>thensrvE(l)elsesrvE(Err) Init job|srv(Web) |Web srvE(Done) Add possibility of an error:
Concluding Remarks • Developed an RL model for TiMo. • Use strategies to capture maximal parallel computational steps. • Proved RL model is correct: sound and complete. • Used Elan to implement an analysis tool. • Future work includes: • Extend to TiMo with access permissions. • Enhance tool support (i.e. Maude). • Investigate alternative semantic choices for TiMo. • Detailed case studies.