An Abstract Machine for Asynchronous Programs with Closures and Priority Queues

  • Davide Ancona
  • Giorgio Delzanno
  • Luca Franceschini
  • Maurizio Leotta
  • Enrico Prampolini
  • Marina Ribaudo
  • Filippo Ricca
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10506)

Abstract

We present the operational semantics of an abstract machine that models computations of event-based asynchronous programs inspired to the Node.js server-side system, a convenient platform for developing Internet of Things applications. The goal of the formal description of Node.js internals is twofold: (1) integrating the existing documentation with a more rigorous semantics and (2) validating widely used programming and transformation patterns by means of mathematical tools like transition systems. Our operational semantics is parametric in the transition system of the host scripting language to mimic the infrastructure of the V8 virtual machine where Javascript code is executed on top of the event-based engine provided by the C++ libuv concurrency library. In this work we focus our attention on priority callback queues, nested callbacks, and closures; these are widely used Node.js programming features which, however, may render programs difficult to understand, manipulate, and validate.

References

  1. 1.
    Alimadadi, S., Sequeira, S., Mesbah, A., Pattabiraman, K.: Understanding javascript event-based interactions with clematis. ACM Trans. Softw. Eng. Methodol. 25(2), 12:1–12:38 (2016)CrossRefGoogle Scholar
  2. 2.
    Chadha, R., Viswanathan, M.: Decidability results for well-structured transition systems with auxiliary storage. In: Caires, L., Vasconcelos, V.T. (eds.) CONCUR 2007. LNCS, vol. 4703, pp. 136–150. Springer, Heidelberg (2007). doi:10.1007/978-3-540-74407-8_10 CrossRefGoogle Scholar
  3. 3.
    Emmi, M., Ganty, P., Majumdar, R., Rosa-Velardo, F.: Analysis of asynchronous programs with event-based synchronization. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 535–559. Springer, Heidelberg (2015). doi:10.1007/978-3-662-46669-8_22 CrossRefGoogle Scholar
  4. 4.
    Gallaba, K., Mesbah, A., Beschastnikh, I.: Don’t call us, we’ll call you: characterizing callbacks in Javascript. In: 2015 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, ESEM 2015, Beijing, China, 22–23 October 2015, pp. 247–256 (2015)Google Scholar
  5. 5.
    Ganty, P., Majumdar, R.: Analyzing real-time event-driven programs. In: Ouaknine, J., Vaandrager, F.W. (eds.) FORMATS 2009. LNCS, vol. 5813, pp. 164–178. Springer, Heidelberg (2009). doi:10.1007/978-3-642-04368-0_14 CrossRefGoogle Scholar
  6. 6.
    Ganty, P., Majumdar, R.: Algorithmic verification of asynchronous programs. ACM Trans. Program. Lang. Syst. 34(1), 6:1–6:48 (2012)CrossRefGoogle Scholar
  7. 7.
    Ganty, P., Majumdar, R., Rybalchenko, A.: Verifying liveness for asynchronous programs. POPL 2009, 102–113 (2009)MATHGoogle Scholar
  8. 8.
    Geeraerts, G., Heußner, A., Raskin, J.-F.: On the verification of concurrent, asynchronous programs with waiting queues. ACM Trans. Embedded Comput. Syst. 14(3), 58:1–58:26 (2015)CrossRefGoogle Scholar
  9. 9.
    Park, D., Stefanescu, A., Rosu, G.: KJS: a complete formal semantics of javascript. PLDI 2015, 346–356 (2015)Google Scholar
  10. 10.
    Sen, K., Viswanathan, M.: Model checking multithreaded programs with asynchronous atomic methods. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 300–314. Springer, Heidelberg (2006). doi:10.1007/11817963_29 CrossRefGoogle Scholar
  11. 11.
  12. 12.
  13. 13.
  14. 14.
  15. 15.
  16. 16.

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  • Davide Ancona
    • 1
  • Giorgio Delzanno
    • 1
  • Luca Franceschini
    • 1
  • Maurizio Leotta
    • 1
  • Enrico Prampolini
    • 1
  • Marina Ribaudo
    • 1
  • Filippo Ricca
    • 1
  1. 1.Dip. di Informatica, Bioingegneria, Robotica e Ingegneria dei Sistemi (DIBRIS)Università di GenovaGenoaItaly

Personalised recommendations