250 likes | 332 Vues
This research work focuses on developing a reversible abstract machine for the higher-order language Oz. By adding history information and unique names to threads and queues, the space complexity analysis is performed to make Oz reversible. The reversible abstract machine enjoys the same basic properties as RCCS and rhopi, ensuring preservation of semantics and causal consistent reversibility. The space overhead is computed and proved to be linear in the number of computation steps, with a lower bound demonstrated for optimality. Overall, this work presents a pathway for reversing Oz with improved space efficiency.
E N D
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
Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions
Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions
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?
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
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
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
Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions
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
Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions
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
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
Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions
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
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
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
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
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
Roadmap • Origin of the work • μOz • Reversing μOz • Space overhead • Conclusions
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
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
Finally Thanks! Questions?