1 / 25

A Reversible Abstract Machine

A Reversible Abstract Machine. Ivan Lanese Focus research group Computer Science Department Univers ity of Bologna/INRIA Italy. Joint work with Michael Lienhardt, Claudio Mezzina and Jean-Bernard Stefani. Roadmap. Origin of the work μ Oz Reversing μ Oz Space overhead Conclusions.

Télécharger la présentation

A Reversible Abstract Machine

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Reversible Abstract Machine Ivan Lanese Focus research group Computer Science Department University of Bologna/INRIA Italy Joint work with Michael Lienhardt, Claudio Mezzina and Jean-Bernard Stefani

  2. Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions

  3. Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions

  4. Rhopi and space efficiency • Rhopi is a causally-consistent reversible HOpi • Developed by Sardes and Focus • Used to study reversibility in presence of (higher-order) communication • Memory efficiency was not considered • Memory consumption due to storing history information • Is rhopi a space efficient way of making HOpi reversible? • Intuitively not, because of duplication of communicated messages and of trigger continuations • What can we do to improve its space efficiency?

  5. Giving a formal answer to the question • Rhopi space consumption should be compared to HOpi one • HOpi is at a very high-level of abstraction • Difficult to understand the actual amount of memory used by an HOpi process • HOpi may not be space efficient on its own • We would need an abstract machine for HOpi • Providing an efficient implementation • Accepted by the community • No such abstract machine exists for HOpi • Actually no abstract machine at all

  6. A path towards the solution • We move from HOpi to Oz • We choose a kernel language of it, which we call μOz • μOz is an higher-order language • Thread-based concurrency • Asynchronous communication via ports • μOz advantages: • Similar to Hopi • Has a well-known and rather classical stack based abstract machine • Suitable as a reference implementation • We do the space complexity analysis in μOz setting

  7. A side effect • μOz is nearer to real languages • Stores and variables • Sequence, if-then-else and procedure calls • We test the techniques developed for HOpi in a more realistic scenario • Further steps needed to tackle real languages

  8. Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions

  9. S S t t t : : a e m e n s = k i E s p t t t t m p y s a e m e n j S S l S i i i t t e q u e n a c o m p o s o n 1 2 j l i d S t b l d l V i i e n e n x v t = a r a e e c a r a o n j i f h l d S S t d l C i i e n e s e e n x t t t t o n o n a s a e m e n s 1 2 j h d d S t h d T i r e a e n t r e a c r e a o n j l i d S t d d l P i e n e n x c t = r o c e u r e e c a r a o n j f g d l l P x x x r o c e u r e c a 1 n : : : j l i d S t N P t P i e n e n x e w o r t t = o r c r e a o n j f g S d d S e n x y t e n o n a p o r j f g l i d S t R i f R i e n e n x e c e v e y t = e c e v e r o m a p o r j f l l l S i t r u e a s e v : : m p e v a u e s = f g d d S P p r o c e n c : : x x r o c e u r e = 1 n : : : μOz syntax

  10. μOz semantics

  11. Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions

  12. Making μOz reversible • We add history information to each thread • Keeping trace of actions executed in the past • For most statements, we add a delimiter esc to define their scope • E.g., for let, if-then-else and procedure call • We add unique names to threads • We add history information also to queues • We add a symmetric version for each rule

  13. μOz reversible semantics: forward rules

  14. μOz reversible semantics: backward rules

  15. Basic properties • The μOz reversible abstract machine enjoys the same basic properties of RCCS and rhopi • Preservation of μOz semantics • Loop Lemma • Every step can be perfectly undone • Causal consistent reversibility • Coinitial traces are cofinal iff they are causally equivalent

  16. Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions

  17. Space complexity • We can now go back to our original question • We compute the space overhead of the reversible abstract machine w.r.t. the original one • Size of the reversible configuration minus size of the corresponding μOz one • For a fixed program, the overhead is linear in the number of computation steps • Clear by looking at the size of the stored history information • Only non constant information for discarded branch of if-then-else and number of parameters of procedure calls

  18. Optimality of linear memory overhead • Is the space overhead optimal (in order of magnitude)? • We prove a linear lower bound by giving a program that requires at least a linear overhead

  19. l i t N P t e n a e w o r = l i t t e r u e n x = l f l i t e a s e n y = l d i 1 1 t S d e p r o c e n n p e n a x p = l d i 2 2 t S d e p r o c e n n p e n a y p = l l i d d i 3 3 t t R i e p r o c e n e n e n n p z e c e v e a p = = h d d 1 t r e a e n p h d d 2 t r e a e n p h d d 3 t r e a e n p d d d d d d e n e n e n e n e n e n Linear lower bound • Thread p1 sends true, thread p2 sends false • All the computations sending the same number of true and of false lead to the same state

  20. Proof strategy • Consider computations where all the sends are done before all the receives • Divide the sends in pair, and consider the computations where in each pair a send is from p1 and one from p2 • Same number of true and false • Two possibilities for each pair • All the computations are coinitial and cofinal and not causally equivalent • We need to distinguish them • We need one bit for each pair • All the possibilities, thus also incompressible strings • The number of bits is linear in the number of steps

  21. Discussion • Overhead due to nondeterminism in communications • A similar example can be defined for nondeterminism in thread scheduling • Deterministic computations actually would need less space • Just the number of performed steps, which takes logerithmic space • Tradeof between space and time efficiency

  22. Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions

  23. Summary • A reversible abstract machine for μOz • Linear overhead with respect to the standard machine • A linear lower bound for the overhead • Due to nondeterminism

  24. Future work • Proceeding towards real languages • Modules, types, exceptions, … • Concurrent ML? • Analyze space efficiency for controlled reversibility • Roll-pi, croll-pi • Analyze different tradeofs between space and time overhead

  25. Finally Thanks! Questions?

More Related