600 likes | 709 Views
Reversibility and beyond. Ivan Lanese Computer Science Department Focus research group Univers ity of Bologna/INRIA Bologna, Italy. Summarizing work of INRIA teams Sardes and Focus. Roadmap. Directions Rhopi Roll-pi Crop What next?. Roadmap. Directions Rhopi Roll-pi Crop
E N D
Reversibility and beyond Ivan Lanese Computer Science Department Focus research group University of Bologna/INRIA Bologna, Italy Summarizing work of INRIA teams Sardes and Focus
Roadmap • Directions • Rhopi • Roll-pi • Crop • What next?
Roadmap • Directions • Rhopi • Roll-pi • Crop • What next?
Reversibility and beyond • We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus • Rhopi: making HOpi reversible • Roll-pi: introducing an operator for controlling reversibility • Crop: adding compensations
Reversibility and beyond • We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus • Rhopi: making HOpi reversible • Extending reversibility techniques from CCS to more expressive calculi • Preserving structural congruence • Roll-pi: introducing an operator for controlling reversibility • Crop: adding compensations
Reversibility and beyond • We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus • Rhopi: making HOpi reversible • Roll-pi: introducing an operator for controlling reversibility • To model checkpointing and rollbacking techniques • Exploiting and constraining reversibility • Crop: adding compensations
Reversibility and beyond • We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus • Rhopi: making HOpi reversible • Roll-pi: introducing an operator for controlling reversibility • Crop: adding compensations • Only preliminary ideas • Keeping trace of past failures • Avoiding repeating the same errors • Going towards long running transactions
The small-step approach • We start from a basic calculus: Rhopi • We add to it the smallest mechanism we can think of going in the desired direction • Rollback primitive • Compensating messages • We study how far we can go with these mechanisms
Roadmap • Directions • Rhopi • Roll-pi • Crop • What next?
h i P Q P : : a m e s s a g e = ; j ( ) X P i t . a r g g e r j ( j ) l l l P Q i i t p a r a e c o m p o s o n j P º a n e w n a m e : j b l X i v a r a e j l l 0 n u p r o c e s s Q h i j ( ( ) ) f = g Q X P P . a a ! X HOpi fundamentals
h i j ( ( ) ) j ( j ) j j j P Q P X P P Q P X 0 . : : a a º a = ; : ¯ M N i t c o n g u r a o n s : : = ; h d P t r e a · : j [ ] k m e m o r y m ; j ( j ) l l l M N p a r a e j M i i t t r e s r c o n º u : j l l ¯ i 0 t n u c o n g u r a o n ~ j h i k h h k t ¢ a g s · : : = ; ( ( h i ) j ( ( ) ) ) d P X Q i t . a c o n r e c o r m : : · : a · : a = 1 2 Rhopi syntax
( h i ) j ( ( ) ) P X Q . m · : a · : a = 1 2 F o r w a r d : P ( h i ) j ( ( ) ) ( f = g ) j [ ] k k k P X Q Q ³ . · : a · : a º : m ; X 1 2 : ( ) j [ ] k k P B a c k w a r d : m ; m : Ã Rhopi semantics • A forward rule similar to HOpi • Creating a fresh tag for the continuation • Creating a memory storing the consumed message and trigger • A backward rule undoing a step (up to garbage collection)
( h ( i ) ) h h i h j i i k k k b b d X P X X 0 0 . . : : : a a c 3 2 1 Rhopi example
[ h ( ( h h j i ) ) i i h h i h j i i ] k k k k k b b d k b d k M X X P N X 0 0 0 . . : : : : : a a c : ; 2 1 3 1 2 Rhopi example
[ [ ( h ( ( h h h h h j i ) i ) i j i i i h h j h i i h ) j i i ] ] k k k k k k k b b b d d k d b d k k k M X P X N X N 0 0 0 0 0 0 . . : : : : : : : a a c c : ; : ; 3 1 4 2 1 2 3 1 4 Rhopi example
[ h ( ( h h j i ) ) i i h h i h j i i ] k k k k k b b d k b d k M X X P N X 0 0 0 . . : : : : : a a c : ; 2 1 3 1 2 Rhopi example
( h ( i ) ) h h i h j i i k k k b b d X P X X 0 0 . . : : : a a c 3 2 1 Rhopi example
n n Y Y ~ ~ ~ ( h i ) f g k h h h k h h h ( ) E T P ´ ¢ : ¿ º : ¿ a g = i i i 1 n : ; ; : : : ; . i i 1 1 = = Rhopi structural congruence • Used for ensuring each thread has a unique tag • Needed if the continuation of a trigger is a parallel composition • Here τ is either a message or a trigger • Other structural congruence rules are standard
³ Ã Rhopi properties • Rhopi is an extension of HOpi • Rhopi satisfies the Loop lemma • If P Q then Q P and viceversa • All states reachable from P are weak barbed equivalent to P itself • Rhopi satisfies causal consistency • Essentially the same properties of RCCS
Roadmap • Directions • Rhopi • Roll-pi • Crop • What next?
Limits of Rhopi • In Rhopi reversibility is wild • Forward and backward actions always enabled • Each result can always be annulled • Impossible to make a result final • We want a mechanism to control reversibility
Roll-pi approach • Normal computation is forward • Backward computation on demand, to backtrack in case of errors • We use an explicit roll operator to this end • Question: how far back should we go? • In a concurrent scenario the number of steps is not meaningful • Answer: we go back to undo a communication stored in a specified memory • Memory keys allows to individuate the target memory
j j j ( j ) j h i j ( ) j l l P Q X P P Q P X P 0 . r o : : º a a a ° = ° ; : j j ( j ) j j [ ] k M N M M N P 0 : : º u · : ¹ ; = ; : Roll-pi syntax • Extends Rhopi syntax • Adds the primitive roll γ for triggering rollback • Adds a γ label to triggers • The idea: roll γ takes the system back to the state before the trigger labelled by γ has been consumed • More precisely: undoes all the steps caused by the interaction involving the trigger labelled by γ
( h i ) j ( ( ) ) P X Q . m · : a · : a = 1 2 ° ( ) C & N o m k P k ( h i ) j ( ( ) ) ( f = g ) j [ ] k k k P X Q Q ³ ; . · : a · : a º : m ; X 1 2 ° ° : ; ( j [ ] j ( ) ) k k l l k N N l t I r o c o m p e e m ; · : ( ) N a i v e j [ ] j ( ) j k l l k & N N r o m ; · : m à k Giving semantics: naïve try • The forward rule uses the key k to replace the placeholder γ • A rule for roll • N ►k verifies that all the elements in N are related to k • Complete checks that the term is closed under the causal relation • contains the elements in N not related to k
( h ( i ) ) h h i j i k k k b b l l X X X 0 0 . . r o : : : a a c ° 3 2 1 ° Naïve semantics example
[ h ( h ( i j ) ) i h h i j ] i k k k k k b b l l k k b l k l M X X N X 0 0 . . r o r o : : : : : a a c : ; ° 1 3 2 1 2 ° Naïve semantics example
~ ~ h [ h [ h ( h ( i i i j j ) ) i h h h i i j ] i ] k k k k k k h h b b h h l k k l k k k b l l k l k l k M M X X N N X 0 0 0 . . r o ¢ ¢ r o r o : : : : : : a a : : c : : c ; ; ° 3 2 1 1 1 2 1 4 4 2 3 1 4 ° ; ; Naïve semantics example
~ ~ h [ h [ h ( h ( i i i j j ) ) i h h h i i j ] i ] k k k k k k h h b b h h l k k l k k k b l l k l k l k M M X X N N X 0 0 0 . . r o ¢ ¢ r o r o : : : : : : a a : : c : : c ; ; ° 3 2 1 1 1 2 1 4 4 2 3 1 4 ° ; ; Naïve semantics example
( h ( i ) ) h h i j i k k k b b l l X X X 0 0 . . r o : : : a a c ° 3 2 1 ° Naïve semantics example
k k l l l l k k r r o o 1 1 The concurrency anomaly
k k l l l l k k r r o o 1 1 The concurrency anomaly
k 1 The concurrency anomaly
k k l l l l k k r r o o 1 1 The concurrency anomaly
k The concurrency anomaly
The concurrency anomaly • Intuitively, I have rolls for undoing every action… • …but I am not able to go back to the starting state • I miss the possibility of performing rollbacks concurrently • Forcing this sequential behavior in a distributed implementation would not be easy • Can I write a semantics capturing concurrent rollbacks?
( h i ) j ( ( ) ) P X Q . m · : a · : a = 1 2 ° ( ) C o m k P ( h i ) j ( ( ) ) ( f = g ) j [ ] k k k P X Q Q ³ ; . · : a · : a º : m ; X 1 2 ° ° : ; ( ) j [ ] ( ) j [ ] ² l l k k l l k k ( ) S t a r t r o r o · : m ; · : m ; à 1 1 ( j [ ] ) k k N N l t I c o m p e e m ; ( ) R o l l j [ ] j ² k & N N m ; m à k Giving semantics: taming concurrency • The rollback has been splitted in two steps • Tagging the memory • Executing the rollback of a tagged memory
k k l l l l k k r r o o 1 1 Concurrent rollback
k k l l l l k k r r o o 1 1 Concurrent rollback
k k l l l l k k r r o o 1 1 Concurrent rollback
k 1 Concurrent rollback
0 0 0 f h h d k d ¤ ¤ M M M M M M i i t t ³ e n w a n u n m a r e à , Properties of concurrent semantics • Correct • If I go backward from M, I reach a state able to go forward to M • Complete • I can execute any number of concurrent rollbacks • Good as abstract specification
Going towards an implementation • The concurrent semantics is very high-level • Includes atomic steps involving an unbounded number of participants • Concurrently executing • Possibly distributed • Can we refine the semantics to a more distributed one? • Giving the same final result • Yes! • But technicalities are quite complex…
k l l k r o Low level semantics
k l l k r o Low level semantics
k l l k r o Low level semantics
k l l k r o Low level semantics
k Low level semantics
Low level semantics • Based on local checks and asynchronous notifications • In two phases • Top-down notification of rollback request • Bottom-up rollback • Equivalent to the concurrent one • Weak barbed congruent • Fully abstract • A good starting point for a concurrent and distributed implementation • Writing a low level semantics equivalent to the naïve one would be more difficult