Skip to main content

Towards Causal-Consistent Reversibility of Imperative Concurrent Programs

  • Conference paper
  • First Online:
Reversible Computation (RC 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13354))

Included in the following conference series:

Abstract

We describe an ongoing work of defining and implementing a form of reversibility of concurrent programs where causally independent steps can be undone out of backtracking order. We introduce a notion of causal independence between steps of reverse execution and adjust the previously developed method for backtracking reversibility to move towards obtaining causal-consistent reversibility.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Additionally, previous work included the reversal of potentially recursive procedures. We omit procedures here and defer reversing them to future work.

References

  1. Bergstra, J.A., Ponse, A., van Wamel, J.J.: Process algebra with backtracking. In: de Bakker, J.W., de Roever, W.-P., Rozenberg, G. (eds.) REX 1993. LNCS, vol. 803, pp. 46–91. Springer, Heidelberg (1994). https://doi.org/10.1007/3-540-58043-3_17

    Chapter  Google Scholar 

  2. Bernstein, D., Rodeh, M.: Global instruction scheduling for superscalar machines. In: SIGPLAN 1991 Conference on Programming Language Design and Implementation, Proceedings of the ACM, pp. 241–255 (1991)

    Google Scholar 

  3. Cooper, K.D., Torczon, L.: Instruction scheduling. In: Engineering a Compiler, 2nd edn., pp. 639–677. Morgan Kaufmann (2012)

    Google Scholar 

  4. Danos, V., Krivine, J.: Reversible communicating systems. In: Gardner, P., Yoshida, N. (eds.) CONCUR 2004. LNCS, vol. 3170, pp. 292–307. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-28644-8_19

    Chapter  Google Scholar 

  5. Engblom, J.: A review of reverse debugging. In: Proceedings of the 2012 System, Software, SoC and Silicon Debug Conference (2012)

    Google Scholar 

  6. Giachino, E., Lanese, I., Mezzina, C.A.: Causal-consistent reversible debugging. In: Proceedings of FASE 2014 (2014). https://doi.org/10.1007/978-3-642-54804-8_26

  7. Hoey, J.: Reversing an Imperative Concurrent Programming Language. Ph.D. thesis, University of Leicester (2019)

    Google Scholar 

  8. Hoey, J., Lanese, I., Nishida, N., Ulidowski, I., Vidal, G.: A case study for reversible computing: reversible debugging of concurrent programs. In: Ulidowski, I., Lanese, I., Schultz, U.P., Ferreira, C. (eds.) RC 2020. LNCS, vol. 12070, pp. 108–127. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-47361-7_5

    Chapter  Google Scholar 

  9. Hoey, J., Ulidowski, I.: Reversible imperative parallel programs and debugging. In: Thomsen, M.K., Soeken, M. (eds.) RC 2019. LNCS, vol. 11497, pp. 108–127. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-21500-2_7

    Chapter  MATH  Google Scholar 

  10. Lanese, I., Nishida, N., Palacios, A., Vidal, G.: CauDEr: a causal-consistent reversible debugger for Erlang. In: Gallagher, J.P., Sulzmann, M. (eds.) FLOPS 2018. LNCS, vol. 10818, pp. 247–263. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-90686-7_16

    Chapter  Google Scholar 

  11. Lanese, I., Palacios, A., Vidal, G.: Causal-consistent replay reversible semantics for message passing concurrent programs. Fundamenta Informaticae 178(3), 229–266 (2021)

    Article  MathSciNet  Google Scholar 

  12. Lanese, I., Phillips, I., Ulidowski, I.: An axiomatic approach to reversible computation. In: FoSSaCS 2020. LNCS, vol. 12077, pp. 442–461. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-45231-5_23

    Chapter  MATH  Google Scholar 

  13. Perumalla, K.: Introduction to Reversible Computing. CRC Press (2014)

    Google Scholar 

  14. Phillips, I., Ulidowski, I.: Reversing algebraic process calculi. J. Log. Algebraic Program. 73, 70–96 (2007)

    Google Scholar 

  15. Schordan, M., Oppelstrup, T., Jefferson, D.R., Barnes, P.D.: Generation of reversible C++ code for optimistic parallel discrete event simulation. New Generation Comput. 36(3), 257–280 (2018)

    Article  Google Scholar 

  16. Vulov, G., Hou, C., Vuduc, R.W., Fujimoto, R., Quinlan, D.J., Jefferson, D.R.: The backstroke framework for source level reverse computation applied to parallel discrete event simulation. In: WSC 2011 (2011)

    Google Scholar 

  17. Yokoyama, T., Axelsen, H.B., Glück, R.: Fundamentals of reversible flowchart languages. Theore. Comput. Sci. 611, 87–115 (2016)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to James Hoey .

Editor information

Editors and Affiliations

Appendices

A Causally Independent Interleavings

The backtracking reversal execution sequence from Example 2 is shown in Fig. 2 as the path from IP\(_{11}\) via IP\(_{8}^{18}\) and IP\(_{7}\), then all the way down to IP\(_{2}\) before finishing at IP\(_{0}^{14}\). The alternative reversal shown in Example 4 is the path described above but with the detour from IP\(_{4}^{16}\) to IP\(_{1}\). As seen from the rest of the diagram, any full path is a valid execution that can be gotten from the main execution by changing order of causally independent transitions.

There are many possible executions of the forward program from Example 1. For each such execution, there is a particular inverted program which will have a backtracking execution sequence. Moreover, there will be potentially many other execution sequences originating from that backtracking sequence that preserve causal independence. This is illustrated in the next example.

Example 5

Consider a different execution of the program from Example 1, where one full iteration of the while loop is executed first. Then we perform the entire conditional statement (executing the false branch), and follow it by doing the second loop iteration, producing the following execution sequence.

Fig. 2.
figure 2

All possible executions of the inverted program from Example 2 preserving causal independence. To improve presentation of transition labels we have only retained bracketed identifiers or skip numbers omitting the names of statements. For example instead of X=4[11] we write [11] as the label of the first transition, and we write (19) instead of skip(19) in the second transition.

Under backtracking reversal, the second while loop iteration must be reversed first. This would produce the following execution sequence.

By Definition 2, we have that the opening/closing of a conditional statement is independent of any statements of the loop (no re-evaluation of the expression). The false branch statement Z=3 is independent of any statements of the loop. The entire conditional statement can be reversed prior to any reversal of the loop. This causally consistent reversal produces the following execution sequence.

B Local Variables

The programming language used throughout this work supports global and local variables. A global variable is uniquely named and assumed to exist prior to the execution. At an implementation level, each global variable is associated with a unique memory location. Global variables are accessible from any point within the program, with each use referring to the same memory location.

The syntax shown in Fig. 1 introduces block statements of the form DV; P; RV, where DV is a sequence of local variable declaration statements, P is a program and RV is a sequence of local variable removal statements. A local variable declaration statement (only possible at the beginning of a block) creates a new variable local to the block statement. A unique memory location is associated with this local variable, keeping the value it holds separate to that of the global version. This local variable is only accessible from within the same block statement. If a local variable is named uniquely (including to global variables), then this is treated exactly the same as a global variable. Should a local variable share its name with a global variable, the global variable is no longer accessible within this block statement. Any use of this name within the block statement will refer to the local version (and not the memory location associated with the global version). At the end of a block, each local variable must then be removed via a local variable removal statement. This deletes the final value this variable held and releases the memory location.

Let us first consider whether local variable declaration statements can race. Within a single block, our syntax does not support parallel statements within DV. Therefore two declaration statements within the same block cannot race. Two blocks can be in parallel, meaning declaration statements from different blocks can be executed in parallel. Since each will use a fresh memory location and therefore refer to a different variable (or version if the same name is used), these also cannot race. Similar reasoning can be given for removal statements but is omitted here.

We now consider races between uses of local variables. A parallel statement within a block may contain uses of the same local variable in parallel. Such statements will race according to Definition 1. Two block statements can be in parallel, each of which may declare a local variable with the same name. Any two statements such that each is from a different side of this parallel statement cannot race as this name will refer to a different version of this variable (a different memory location). Two uses of the same variable name on a single side of the parallel will race as explained above.

We conclude that local variable declaration and removal statements cannot race, and are therefore not included in our definition of a data race (Definition 1).

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Hoey, J., Ulidowski, I. (2022). Towards Causal-Consistent Reversibility of Imperative Concurrent Programs. In: Mezzina, C.A., Podlaski, K. (eds) Reversible Computation. RC 2022. Lecture Notes in Computer Science, vol 13354. Springer, Cham. https://doi.org/10.1007/978-3-031-09005-9_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-09005-9_15

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-09004-2

  • Online ISBN: 978-3-031-09005-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics