60
1 Summarizing work of INRIA teams Sardes and Focus Reversibility and beyond Ivan Lanese Computer Science Department Focus research group University of Bologna/INRIA Bologna, Italy

Reversibility and beyond

  • Upload
    tamber

  • View
    41

  • Download
    0

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: Reversibility and beyond

1

Summarizing work of INRIA teams Sardes and Focus

Reversibility and beyond

Ivan LaneseComputer Science Department

Focus research groupUniversity of Bologna/INRIA

Bologna, Italy

Page 2: Reversibility and beyond

Roadmap

Directions

Rhopi

Roll-pi

Crop

What next?

Page 3: Reversibility and beyond

Roadmap

Directions

Rhopi

Roll-pi

Crop

What next?

Page 4: Reversibility and beyond

Reversibility and beyond

We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus

1) Rhopi: making HOpi reversible

2) Roll-pi: introducing an operator for controlling reversibility

3) Crop: adding compensations

Page 5: Reversibility and beyond

Reversibility and beyond

We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus

1) Rhopi: making HOpi reversible• Extending reversibility techniques from CCS to more

expressive calculi

• Preserving structural congruence

2) Roll-pi: introducing an operator for controlling reversibility

3) Crop: adding compensations

Page 6: Reversibility and beyond

Reversibility and beyond

We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus

1) Rhopi: making HOpi reversible

2) Roll-pi: introducing an operator for controlling reversibility

• To model checkpointing and rollbacking techniques

• Exploiting and constraining reversibility

3) Crop: adding compensations

Page 7: Reversibility and beyond

Reversibility and beyond

We summarize here the thread of research done on reversibility by INRIA teams Sardes and Focus

1) Rhopi: making HOpi reversible

2) Roll-pi: introducing an operator for controlling reversibility

3) Crop: adding compensations • Only preliminary ideas

• Keeping trace of past failures

• Avoiding repeating the same errors

• Going towards long running transactions

Page 8: Reversibility and beyond

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

Page 9: Reversibility and beyond

Roadmap

Directions

Rhopi

Roll-pi

Crop

What next?

Page 10: Reversibility and beyond

HOpi fundamentals

P;Q ::= ahP i message

j a(X ) . P trigger

j (P j Q) parallel composition

j ºa:P new name

j X variable

j 0 null process

ahQi j (a(X ) . P ) ! P f Q=X g

Page 11: Reversibility and beyond

Rhopi syntax

P;Q ::= ahP i j (a(X ) . P ) j (P j Q) j ºa:P j X j 0

M ;N ::= con̄ gurations

· : P thread

j [m;k] memory

j (M j N ) parallel

j ºu:M restriction

j 0 null con̄ guration

· ::= k j hh;~hi ¢k tags

m ::= ((· 1 : ahP i) j (· 2 : a(X ) . Q)) action record

Page 12: Reversibility and beyond

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)

Forwar d:m = (· 1 : ahP i) j (· 2 : a(X ) . Q)

(· 1 : ahP i) j (· 2 : a(X ) . Q) ³ ºk:(k : Qf P =X g) j [m;k]

Backwar d: (k : P ) j [m;k] Ã m

Page 13: Reversibility and beyond

Rhopi example

k3 : b(X ) . ch0i j Xk1 : ahP i k2 : a(X ) . bhdh0ii

Page 14: Reversibility and beyond

Rhopi example

k3 : b(X ) . ch0i j X

[k1 : M j k2 : N ;k]

k : bhdh0i i

k1 : ahP i k2 : a(X ) . bhdh0ii

Page 15: Reversibility and beyond

Rhopi example

k3 : b(X ) . ch0i j X

[k1 : M j k2 : N ;k]

k : bhdh0i i

[k : bhdh0i i j k3 : N1;k4]

k4 : (ch0i j dh0i)

k1 : ahP i k2 : a(X ) . bhdh0ii

Page 16: Reversibility and beyond

Rhopi example

k3 : b(X ) . ch0i j X

[k1 : M j k2 : N ;k]

k : bhdh0i i

k1 : ahP i k2 : a(X ) . bhdh0ii

Page 17: Reversibility and beyond

Rhopi example

k3 : b(X ) . ch0i j Xk1 : ahP i k2 : a(X ) . bhdh0ii

Page 18: Reversibility and beyond

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

(E.TagP) k :nY

i=1

¿i ´ º~h:nY

i=1

(hhi ;~hi ¢k : ¿i ) ~h = fh1; : : : ;hng

Page 19: Reversibility and beyond

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

³ Ã

Page 20: Reversibility and beyond

Roadmap

Directions

Rhopi

Roll-pi

Crop

What next?

Page 21: Reversibility and beyond

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

Page 22: Reversibility and beyond

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

Page 23: Reversibility and beyond

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 γ

P;Q ::= 0 j X j ºa:P j (P j Q) j ahP i j a(X ) . ° P j roll °

M ;N ::= 0 j ºu:M j (M j N ) j · : P j [¹ ;k]

Page 24: Reversibility and beyond

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

(Com)m = (· 1 : ahP i) j (· 2 : a(X ) . ° Q)

(· 1 : ahP i) j (· 2 : a(X ) . ° Q) ³ ºk:(k : Qf k;P =° ;X g) j [m;k]

(Naive)N I k compl ete(N j [m;k] j (· : roll k))

N j [m;k] j (· : roll k) Ã m j N & k

N & k

Page 25: Reversibility and beyond

Naïve semantics example

k3 : b(X ) . ch0i j Xk1 : ah0i k2 : a(X ) . ° bhroll °i

Page 26: Reversibility and beyond

Naïve semantics example

k3 : b(X ) . ch0i j X

[k1 : M j k2 : N ;k]

k1 : ah0i

k : bhroll ki

k2 : a(X ) . ° bhroll °i

Page 27: Reversibility and beyond

Naïve semantics example

k3 : b(X ) . ch0i j X

[k1 : M j k2 : N ;k]

k1 : ah0i

k : bhroll ki

[k : M1 j k3 : N1;k4]

hh1;~hi ¢k4 : ch0i hh2;~hi ¢k4 : roll k

k2 : a(X ) . ° bhroll °i

Page 28: Reversibility and beyond

Naïve semantics example

k3 : b(X ) . ch0i j X

[k1 : M j k2 : N ;k]

k1 : ah0i

k : bhroll ki

[k : M1 j k3 : N1;k4]

hh1;~hi ¢k4 : ch0i hh2;~hi ¢k4 : roll k

k2 : a(X ) . ° bhroll °i

Page 29: Reversibility and beyond

Naïve semantics example

k3 : b(X ) . ch0i j Xk1 : ah0i k2 : a(X ) . ° bhroll °i

Page 30: Reversibility and beyond

The concurrency anomaly

k k1

roll k roll k1

Page 31: Reversibility and beyond

The concurrency anomaly

k k1

roll k roll k1

Page 32: Reversibility and beyond

The concurrency anomaly

k1

Page 33: Reversibility and beyond

The concurrency anomaly

k k1

roll k roll k1

Page 34: Reversibility and beyond

The concurrency anomaly

k

Page 35: Reversibility and beyond

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?

Page 36: Reversibility and beyond

Giving semantics: taming concurrency

The rollback has been splitted in two steps– Tagging the memory

– Executing the rollback of a tagged memory

(Com)m = (· 1 : ahP i) j (· 2 : a(X ) . ° Q)

(· 1 : ahP i) j (· 2 : a(X ) . ° Q) ³ ºk:(k : Qf k;P =° ;X g) j [m;k]

(Start ) (· 1 : roll k) j [m;k] Ã (· 1 : roll k) j [m;k]²

(Rol l )N I k compl ete(N j [m;k])

N j [m;k]² Ã m j N & k

Page 37: Reversibility and beyond

Concurrent rollback

k k1

roll k roll k1

Page 38: Reversibility and beyond

Concurrent rollback

k k1

roll k roll k1

Page 39: Reversibility and beyond

Concurrent rollback

k k1

roll k roll k1

Page 40: Reversibility and beyond

Concurrent rollback

k1

Page 41: Reversibility and beyond

Concurrent rollback

Page 42: Reversibility and beyond

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

if M Ã ¤ M 0 then M 0³ ¤ M , with M and M 0 unmarked

Page 43: Reversibility and beyond

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…

Page 44: Reversibility and beyond

Low level semantics

k

roll k

Page 45: Reversibility and beyond

Low level semantics

k

roll k

Page 46: Reversibility and beyond

Low level semantics

k

roll k

Page 47: Reversibility and beyond

Low level semantics

k

roll k

Page 48: Reversibility and beyond

Low level semantics

k

Page 49: Reversibility and beyond

Low level semantics

Page 50: Reversibility and beyond

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

Page 51: Reversibility and beyond

Roadmap

Directions

Rhopi

Roll-pi

Crop

What next?

Page 52: Reversibility and beyond

Limits of roll-pi

If I go back, I may redo the same steps infinitely many times– No trace of previous attempts

– No possibility to learn from errors

– Perfect rollback

– Every program that may rollback may diverge

We want a compensation mechanism

Page 53: Reversibility and beyond

Crop idea

Some messages include compensations When rallbacked they are replaced by different

messages– Disabling past computations

– Enabling new computations

Is it enough for implementing compensation policies?

Page 54: Reversibility and beyond

Crop syntax

Extends roll-pi syntax Adds compensating messages ahPi¥C for triggering

rollback C is the message left after rollback in place of ahPi ahPi¥ ? is a message whose compensation is

itself

P;Q ::= 0 j X j ºa:P j (P j Q) j ahP i¥C j a(X ) . ° P j roll °

M ;N ::= 0 j ºu:M j (M j N ) j · : P j [¹ ;k]

C ::= ahP i ¥ C j ?

Page 55: Reversibility and beyond

Idea of crop semantics

Very similar to the semantics of roll-pi Messages are transformed during rollback to their

compensations The compensation mechanism has no effect on the keys

One can write semantics corresponding to naïve, concurrent and low level roll-pi semantics

Page 56: Reversibility and beyond

Comments on crop

Just started work-in-progress A small difference in the syntax and semantics w.r.t.

roll-pi We hope a large difference in the expressive power

Page 57: Reversibility and beyond

Roadmap

Directions

Rhopi

Roll-pi

Crop

What next?

Page 58: Reversibility and beyond

Summary

A reversible HOpi A basic operator for controlling reversibility

– Related to checkpointing

A basic mechanism for compensations

All on topic for WP2

Page 59: Reversibility and beyond

Future work

Testing the expressive power of crop w.r.t. existing techniques for programming dependable systems– Speculative parallelism

– Hennessy communicating transactions

– Transactional memories

What about other mechanisms for controlling reversibility?– Relations with RCCS irreversible actions

What about more efficient ways for storing memories? … and much more

Page 60: Reversibility and beyond

Finally