Asynchronous Cooperative Contracts for Cooperative Scheduling

  • Eduard KamburjanEmail author
  • Crystal Chang Din
  • Reiner Hähnle
  • Einar Broch Johnsen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11724)


Formal specification of multi-threaded programs is notoriously hard, because thread execution may be preempted at any point. In contrast, abstract concurrency models such as actors seriously restrict concurrency to obtain race-free programs. Languages with cooperative scheduling occupy a middle ground between these extremes by explicit scheduling points. They have been used to model complex, industrial concurrent systems. This paper introduces cooperative contracts, a contract-based specification approach for asynchronous method calls in presence of cooperative scheduling. It permits to specify complex concurrent behavior succinctly and intuitively. We design a compositional program logic to verify cooperative contracts and discuss how global analyses can be soundly integrated into the program logic.



This work is supported by the SIRIUS Centre for Scalable Data Access and the FormbaR project, part of AG Signalling/DB RailLab in the Innovation Alliance of Deutsche Bahn AG and TU Darmstadt.


  1. 1.
    Abadi, M., Lamport, L.: Conjoining specifications. ACM Trans. Program. Lang. Syst. 17(3), 507–534 (1995)CrossRefGoogle Scholar
  2. 2.
    ABS Development Team. The ABS Language Specification, January 2018.
  3. 3.
    Agha, G., Hewitt, C.: Actors: a conceptual foundation for concurrent object-oriented programming. In: Research Directions in Object-Oriented Programming, pp. 49–74. MIT Press (1987)Google Scholar
  4. 4.
    Ahrendt, W., Beckert, B., Bubel, R., Hähnle, R., Schmitt, P.H., Ulbrich, M. (eds.): Deductive Software Verification - The KeY Book - From Theory to Practice. LNCS, vol. 10001. Springer, Heidelberg (2016). Scholar
  5. 5.
    Albert, E., et al.: Formal modeling of resource management for cloud architectures: an industrial case study using real-time ABS. J. Serv.-Oriented Comput. Appl. 8(4), 323–339 (2014)CrossRefGoogle Scholar
  6. 6.
    Albert, E., Flores-Montoya, A., Genaim, S., Martin-Martin, E.: May-happen-in-parallel analysis for actor-based concurrency. ACM Trans. Comput. Log. 17(2), 11:1–11:39 (2016)MathSciNetzbMATHGoogle Scholar
  7. 7.
    Armstrong, J.: Programming Erlang: Software for a Concurrent World. Pragmatic Bookshelf Series, Pragmatic Bookshelf (2007)Google Scholar
  8. 8.
    Arslan, V., Eugster, P., Nienaltowski, P., Vaucouleur, S.: SCOOP - concurrency made easy. In: Dependable Systems: Software, Computing, Networks, Research Results of the DICS Program, pp. 82–102 (2006)Google Scholar
  9. 9.
    Baker, H.G., Hewitt, C.E.: The incremental garbage collection of processes. In: Proceeding of the Symposium on Artificial Intelligence Programming Languages, Number 12 in SIGPLAN Notices, p. 11, August 1977Google Scholar
  10. 10.
    Baumann, C., Beckert, B., Blasum, H., Bormer, T.: Lessons learned from microkernel verification - specification is the new bottleneck. In: Cassez, F., Huuck, R., Klein, G., Schlich, B. (eds.) Proceedings of the 7th Conference on Systems Software Verification, volume 102 of EPTCS, pp. 18–32 (2012)CrossRefGoogle Scholar
  11. 11.
    Bocchi, L., Lange, J., Tuosto, E.: Three algorithms and a methodology for amending contracts for choreographies. Sci. Ann. Comp. Sci. 22(1), 61–104 (2012)MathSciNetzbMATHGoogle Scholar
  12. 12.
    Brookes, S., O’Hearn, P.W.: Concurrent separation logic. ACM SIGLOG News 3(3), 47–65 (2016)Google Scholar
  13. 13.
    Caromel, D., Henrio, L., Serpette, B. Asynchronous and deterministic objects. In: Proceedings of the 31st ACM Symposium on Principles of Programming Languages (POPL 2004), pp. 123–134. ACM Press (2004)Google Scholar
  14. 14.
    da Rocha Pinto, P., Dinsdale-Young, T., Gardner, P.: TaDA: a logic for time and data abstraction. In: Jones, R. (ed.) ECOOP 2014. LNCS, vol. 8586, pp. 207–231. Springer, Heidelberg (2014). Scholar
  15. 15.
    de Boer, F., et al.: A survey of active object languages. ACM Comput. Surv. 50(5), 76:1–76:39 (2017)CrossRefGoogle Scholar
  16. 16.
    de Boer, F.S., Clarke, D., Johnsen, E.B.: A complete guide to the future. In: De Nicola, R. (ed.) ESOP 2007. LNCS, vol. 4421, pp. 316–330. Springer, Heidelberg (2007). Scholar
  17. 17.
    Din, C.C., Bubel, R., Hähnle, R.: KeY-ABS: a deductive verification tool for the concurrent modelling language ABS. In: Felty, A.P., Middeldorp, A. (eds.) CADE 2015. LNCS (LNAI), vol. 9195, pp. 517–526. Springer, Cham (2015). Scholar
  18. 18.
    Din, C.C., Owe, O.: Compositional reasoning about active objects with shared futures. Form. Asp. Comput. 27(3), 551–572 (2015)MathSciNetCrossRefGoogle Scholar
  19. 19.
    Din, C.C., Tapia Tarifa, S.L., Hähnle, R., Johnsen, E.B.: History-based specification and verification of scalable concurrent and distributed systems. In: Butler, M., Conchon, S., Zaïdi, F. (eds.) ICFEM 2015. LNCS, vol. 9407, pp. 217–233. Springer, Cham (2015). Scholar
  20. 20.
    Dinsdale-Young, T., da Rocha Pinto, P., Gardner, P.: A perspective on specifying and verifying concurrent modules. J. Log. Algebr. Methods Program. 98, 1–25 (2018)MathSciNetCrossRefGoogle Scholar
  21. 21.
    Flanagan, C., Felleisen, M.: The semantics of future and an application. J. Funct. Program. 9(1), 1–31 (1999)MathSciNetCrossRefGoogle Scholar
  22. 22.
    Gavran, I., Niksic, F., Kanade, A., Majumdar, R., Vafeiadis, V.: Rely/guarantee reasoning for asynchronous programs. In: Aceto, L., de Frutos Escrig, D. (eds.) 26th International Conference on Concurrency Theory (CONCUR 2015), volume 42 of Leibniz International Proceedings in Informatics (LIPIcs), pp. 483–496. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2015)Google Scholar
  23. 23.
    Grahl, D., Bubel, R., Mostowski, W., Schmitt, P.H., Ulbrich, M., Weiß, B.: Modular specification and verification. Deductive Software Verification – The KeY Book. LNCS, vol. 10001, pp. 289–351. Springer, Cham (2016). Scholar
  24. 24.
    Halstead Jr., R.H.: MULTILISP: a language for concurrent symbolic computation. ACM Trans. Program. Lang. Syst. 7(4), 501–538 (1985)CrossRefGoogle Scholar
  25. 25.
    Hansen, P.B.: Structured multiprogramming. Commun. ACM 15(7), 574–578 (1972)CrossRefGoogle Scholar
  26. 26.
    Hansen, P.B.: Operating System Principles. Prentice-Hall Inc., Upper Saddle River (1973)zbMATHGoogle Scholar
  27. 27.
    Harel, D., Kozen, D., Tiuryn, J.: Dynamic logic. SIGACT News 32(1), 66–69 (2001)CrossRefGoogle Scholar
  28. 28.
    Hoare, C.A.R.: Towards a theory of parallel programming. In: Operating System Techniques, pp. 61–71 (1972)CrossRefGoogle Scholar
  29. 29.
    Hoare, C.A.R.: Communicating Sequential Processes. Prentice-Hall Inc., Upper Saddle River (1985)zbMATHGoogle Scholar
  30. 30.
    Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, pp. 273–284 (2008)Google Scholar
  31. 31.
    Huisman, M., Ahrendt, W., Grahl, D., Hentschel, M.: Formal specification with the Java modeling language. Deductive Software Verification – The KeY Book. LNCS, vol. 10001, pp. 193–241. Springer, Cham (2016). Scholar
  32. 32.
    Jeffrey, A., Rathke, J.: Java JR: fully abstract trace semantics for a core Java language. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 423–438. Springer, Heidelberg (2005). Scholar
  33. 33.
    Johnsen, E.B., Hähnle, R., Schäfer, J., Schlatte, R., Steffen, M.: ABS: a core language for abstract behavioral specification. In: Aichernig, B.K., de Boer, F.S., Bonsangue, M.M. (eds.) FMCO 2010. LNCS, vol. 6957, pp. 142–164. Springer, Heidelberg (2011). Scholar
  34. 34.
    Jones, C.B.: Tentative steps toward a development method for interfering programs. ACM Trans. Program. Lang. Syst. 5(4), 596–619 (1983)CrossRefGoogle Scholar
  35. 35.
    Kamburjan, E.: Behavioral program logic. To appear in the proceedings of TABLEAUX 2019, technical report.
  36. 36.
    Kamburjan, E., Chen, T.-C.: Stateful behavioral types for active objects. In: Furia, C.A., Winter, K. (eds.) IFM 2018. LNCS, vol. 11023, pp. 214–235. Springer, Cham (2018). Scholar
  37. 37.
    Kamburjan, E., Din, C.C., Chen, T.-C.: Session-based compositional analysis for actor-based languages using futures. In: Ogata, K., Lawford, M., Liu, S. (eds.) ICFEM 2016. LNCS, vol. 10009, pp. 296–312. Springer, Cham (2016). Scholar
  38. 38.
    Kamburjan, E., Din, C.C., Hähnle, R., Johnsen, E.B.: Asynchronous cooperative contracts for cooperative scheduling. Technical report, TU Darmstadt (2019).
  39. 39.
    Leavens, G.T., et al.: JML Reference Manual, May 2013. Draft revision 2344Google Scholar
  40. 40.
    Liskov, B.H., Shrira, L.: Promises: linguistic support for efficient asynchronous procedure calls in distributed systems. In: Wise, D.S. (ed.) Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation (PLDI 1988), pp. 260–267. ACM Press, June 1988Google Scholar
  41. 41.
    Meyer, B.: Applying “design by contract”. IEEE Comput. 25(10), 40–51 (1992)CrossRefGoogle Scholar
  42. 42.
    O’Hearn, P., Reynolds, J., Yang, H.: Local reasoning about programs that alter data structures. In: Fribourg, L. (ed.) CSL 2001. LNCS, vol. 2142, pp. 1–19. Springer, Heidelberg (2001). Scholar
  43. 43.
    Summers, A.J., Müller, P.: Actor services. In: Thiemann, P. (ed.) ESOP 2016. LNCS, vol. 9632, pp. 699–726. Springer, Heidelberg (2016). Scholar
  44. 44.
    Weiß, B.: Deductive verification of object-oriented software: dynamic frames, dynamic logic and predicate abstraction. Ph.D. thesis, Karlsruhe Institute of Technology (2011)Google Scholar
  45. 45.
    Yonezawa, A., Briot, J.-P., Shibayama, E.: Object-oriented concurrent programming in ABCL/1. In: Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 1986). Sigplan Notices, vol. 21, no. 11, pp. 258–268, November 1986Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Eduard Kamburjan
    • 1
    Email author
  • Crystal Chang Din
    • 2
  • Reiner Hähnle
    • 1
  • Einar Broch Johnsen
    • 2
  1. 1.Department of Computer ScienceTechnische Universität DarmstadtDarmstadtGermany
  2. 2.Department of InformaticsUniversity of OsloOsloNorway

Personalised recommendations