Upload
gregory-richard
View
21
Download
2
Embed Size (px)
DESCRIPTION
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. - PowerPoint PPT Presentation
Citation preview
1
Joint work with Michael Lienhardt, Claudio Mezzina and Jean-Bernard Stefani
A Reversible Abstract Machine
Ivan LaneseFocus research group
Computer Science DepartmentUniversity of Bologna/INRIA
Italy
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
μOz syntax
S ::= Statementsskip Empty statement
j S1 S2 Sequential composition
j let x = v in S end Variable declaration
j if x then S1 else S2 end Conditional statements
j thread S end T hread creation
j let x = c in S end P rocedure declaration
j f x x1 : : :xn g P rocedure call
j let x =NewPort in S end Port creation
j f Send x y g Send on a port
j let x = f Recei ve y g in S end Receive from a port
v ::= true j false Simplevaluesc ::= proc f x1 : : :xn gS end Procedure
μOz semantics
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
μOz reversible semantics: forward rules
μOz reversible semantics: backward rules
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
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
let a= NewPort inlet x = true inlet y = false inlet p1= proc Send a x p1 end inlet p2= proc Send a y p2 end inlet p3= proc let z = Recei ve a in p3 end end in
thread p1 endthread p2 endthread p3 end
end end end end end end
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