Functional Programming for Distributed Systems with XC

Authors Giorgio Audrito , Roberto Casadei , Ferruccio Damiani , Guido Salvaneschi , Mirko Viroli

Thumbnail PDF


  • Filesize: 1.68 MB
  • 28 pages

Document Identifiers

Author Details

Giorgio Audrito
  • University of Turin, Italy
Roberto Casadei
  • University of Bologna, Cesena, Italy
Ferruccio Damiani
  • University of Turin, Italy
Guido Salvaneschi
  • Universität St. Gallen, Switzerland
Mirko Viroli
  • University of Bologna, Cesena, Italy

Cite AsGet BibTex

Giorgio Audrito, Roberto Casadei, Ferruccio Damiani, Guido Salvaneschi, and Mirko Viroli. Functional Programming for Distributed Systems with XC. In 36th European Conference on Object-Oriented Programming (ECOOP 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 222, pp. 20:1-20:28, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


Programming distributed systems is notoriously hard due to - among the others - concurrency, asynchronous execution, message loss, and device failures. Homogeneous distributed systems consist of similar devices that communicate to neighbours and execute the same program: they include wireless sensor networks, network hardware, and robot swarms. For the homogeneous case, we investigate an experimental language design that aims to push the abstraction boundaries farther, compared to existing approaches. In this paper, we introduce the design of XC, a programming language to develop homogeneous distributed systems. In XC, developers define the single program that every device executes and the overall behaviour is achieved collectively, in an emergent way. The programming framework abstracts over concurrency, asynchronous execution, message loss, and device failures. We propose a minimalistic design, which features a single declarative primitive for communication, state management, and connection management. A mechanism called alignment enables developers to abstract over asynchronous execution while still retaining composability. We define syntax and operational semantics of a core calculus, and briefly discuss its main properties. XC comes with two DSL implementations: a DSL in Scala and one in C++. An evaluation based on smart-city monitoring demonstrates XC in a realistic application.

Subject Classification

ACM Subject Classification
  • Theory of computation → Distributed computing models
  • Theory of computation → Functional constructs
  • Theory of computation → Operational semantics
  • Theory of computation → Type structures
  • Computing methodologies → Distributed programming languages
  • Core calculus
  • operational semantics
  • type soundness
  • Scala DSL


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Yehia Abd Alrahman, Rocco De Nicola, and Michele Loreti. Programming interactions in collective adaptive systems by relying on attribute-based communication. Science of Computer Programming, 192, 2020. URL:
  2. Mustaque Ahamad, Gil Neiger, James E. Burns, Prince Kohli, and Phillip W. Hutto. Causal memory: Definitions, implementation, and programming. Distributed Comput., 9(1):37-49, 1995. URL:
  3. Joe Armstrong. Erlang. Commun. ACM, 53(9), September 2010. URL:
  4. Cyrille Artho, Klaus Havelund, Rahul Kumar, and Yoriyuki Yamagata. Domain-specific languages with Scala. In ICFEM, volume 9407 of Lecture Notes in Computer Science, pages 1-16. Springer, 2015. URL:
  5. Giorgio Audrito. FCPP: an efficient and extensible field calculus framework. In Proceedings of the 1st International Conference on Autonomic Computing and Self-Organizing Systems, ACSOS, pages 153-159. IEEE Computer Society, 2020. URL:
  6. Giorgio Audrito, Jacob Beal, Ferruccio Damiani, Danilo Pianini, and Mirko Viroli. Field-based coordination with the share operator. Logical Methods in Computer Science, 16(4), 2020. URL:
  7. Giorgio Audrito, Jacob Beal, Ferruccio Damiani, and Mirko Viroli. Space-time universality of field calculus. In Coordination Models and Languages, volume 10852 of Lecture Notes in Computer Science, pages 1-20. Springer, 2018. URL:
  8. Giorgio Audrito, Roberto Casadei, Ferruccio Damiani, Danilo Pianini, and Mirko Viroli. Optimal resilient distributed data collection in mobile edge environments. Computers & Electrical Engineering, 2021. URL:
  9. Giorgio Audrito, Roberto Casadei, Ferruccio Damiani, Volker Stolz, and Mirko Viroli. Adaptive distributed monitors of spatial properties for cyber-physical systems. J. Syst. Softw., 175:110908, 2021. URL:
  10. Giorgio Audrito, Roberto Casadei, Ferruccio Damiani, and Mirko Viroli. Compositional blocks for optimal self-healing gradients. In Self-Adaptive and Self-Organizing Systems (SASO), 2017, pages 91-100. IEEE, IEEE Computer Society, 2017. URL:
  11. Giorgio Audrito, Ferruccio Damiani, Volker Stolz, Gianluca Torta, and Mirko Viroli. Distributed runtime verification by past-CTL and the field calculus. J. Syst. Softw., 187:111251, 2022. URL:
  12. Giorgio Audrito, Ferruccio Damiani, Mirko Viroli, and Enrico Bini. Distributed real-time shortest-paths computations with the field calculus. In 2018 IEEE Real-Time Systems Symposium (RTSS), pages 23-34. IEEE Computer Society, 2018. URL:
  13. Giorgio Audrito, Luigi Rapetta, and Gianluca Torta. Extensible 3D simulation of aggregated systems with FCPP. In 24th International Conference on Coordination Models and Languages, Proceedings, Lecture Notes in Computer Science. Springer, 2022. To appear. Google Scholar
  14. Jacob Beal. Trading accuracy for speed in approximate consensus. Knowledge Eng. Review, 31(4):325-342, 2016. URL:
  15. Jacob Beal, Stefan Dulman, Kyle Usbeck, Mirko Viroli, and Nikolaus Correll. Organizing the aggregate: Languages for spatial computing. In Formal and Practical Aspects of Domain-Specific Languages: Recent Developments, chapter 16, pages 436-501. IGI Global, 2013. URL:
  16. Jacob Beal, Danilo Pianini, and Mirko Viroli. Aggregate programming for the Internet of Things. IEEE Computer, 48(9), 2015. URL:
  17. Jacob Beal, Mirko Viroli, Danilo Pianini, and Ferruccio Damiani. Self-adaptation to device distribution in the Internet of Things. ACM Transactions on Autonomous and Adaptive Systems, 12(3):12:1-12:29, 2017. URL:
  18. Arne Brutschy, Giovanni Pini, Carlo Pinciroli, Mauro Birattari, and Marco Dorigo. Self-organized task allocation to sequentially interdependent tasks in swarm robotics. Auton. Agents Multi Agent Syst., 28(1):101-125, 2014. URL:
  19. Tomás Bures, Ilias Gerostathopoulos, Petr Hnetynka, Jaroslav Keznikl, Michal Kit, and Frantisek Plasil. DEECO: an ensemble-based component system. In Symposium on Component Based Software Engineering (CBSE), pages 81-90. ACM, 2013. URL:
  20. Roberto Casadei. scafi/artifact-2021-ecoop-smartc: v1.2, 2022. URL:
  21. Roberto Casadei. scafi/artifact-2021-ecoop-xc: v1.2, 2022. URL:
  22. Roberto Casadei, Mirko Viroli, Giorgio Audrito, and Ferruccio Damiani. FScaFi : A core calculus for collective adaptive systems programming. In ISoLA (2), volume 12477 of Lecture Notes in Computer Science, pages 344-360. Springer, 2020. URL:
  23. Roberto Casadei, Mirko Viroli, Giorgio Audrito, Danilo Pianini, and Ferruccio Damiani. Engineering collective intelligence at the edge with aggregate processes. Eng. Appl. Artif. Intell., 97:104081, 2021. URL:
  24. Shane S. Clark, Jacob Beal, and Partha P. Pal. Distributed recovery for enterprise services. In 2015 IEEE 9th International Conference on Self-Adaptive and Self-Organizing Systems, Cambridge, MA, USA, September 21-25, 2015, pages 111-120. IEEE Computer Society, 2015. URL:
  25. Bruno C. d. S. Oliveira, Adriaan Moors, and Martin Odersky. Type classes as objects and implicits. In SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 341-360. ACM, 2010. URL:
  26. Soura Dasgupta and Jacob Beal. A Lyapunov analysis for the robust stability of an adaptive Bellman-Ford algorithm. In Decision and Control (CDC), 2016 IEEE 55th Conference on, pages 7282-7287. IEEE, 2016. URL:
  27. Rocco De Nicola, Michele Loreti, Rosario Pugliese, and Francesco Tiezzi. A formal approach to autonomic systems programming: The SCEL language. ACM Trans. Auton. Adapt. Syst., 9(2):7:1-7:29, 2014. URL:
  28. Mattias De Wael, Stefan Marr, Bruno De Fraine, Tom Van Cutsem, and Wolfgang De Meuter. Partitioned global address space languages. ACM Computing Surveys, 47(4), May 2015. URL:
  29. André DeHon, Jean-Louis Giavitto, and Frédéric Gruau, editors. Computing Media and Languages for Space-Oriented Computation, volume 06361 of Dagstuhl Seminar Proceedings, 2007. URL:
  30. Sébastien Doeraene. Cross-platform language design in Scala.js (keynote). In SCALA@ICFP, page 1. ACM, 2018. URL:
  31. Patrick Th. Eugster, Pascal A. Felber, Rachid Guerraoui, and Anne-Marie Kermarrec. The many faces of publish/subscribe. ACM Comput. Surv., 35(2), June 2003. URL:
  32. Alois Ferscha. Collective adaptive systems. In UbiComp/ISWC Adjunct, pages 893-895. ACM, 2015. URL:
  33. Debasish Ghosh, Justin Sheehy, Kresten Krab Thorup, and Steve Vinoski. Programming language impact on the development of distributed systems. J. Internet Serv. Appl., 3(1):23-30, 2012. URL:
  34. Atsushi Igarashi, Benjamin C. Pierce, and Philip Wadler. Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3), 2001. URL:
  35. Márk Jelasity, Alberto Montresor, and Özalp Babaoglu. Gossip-based aggregation in large dynamic networks. ACM Trans. Comput. Syst., 23(3):219-252, 2005. URL:
  36. Pushpendu Kar, Arijit Roy, and Sudip Misra. Connectivity reestablishment in self-organizing sensor networks with dumb nodes. ACM Trans. Auton. Adapt. Syst., 10(4):28:1-28:30, 2016. URL:
  37. Naomi Kuze, Daichi Kominami, Kenji Kashima, Tomoaki Hashimoto, and Masayuki Murata. Hierarchical optimal control method for controlling large-scale self-organizing networks. ACM Trans. Auton. Adapt. Syst., 12(4):22:1-22:23, 2018. URL:
  38. Alberto Lluch-Lafuente, Michele Loreti, and Ugo Montanari. Asynchronous distributed execution of fixpoint-based computational fields. Log. Methods Comput. Sci., 13(1), 2017. URL:
  39. Thomas W. Malone and Kevin Crowston. The interdisciplinary study of coordination. ACM Comput. Surv., 26(1):87-119, 1994. URL:
  40. Marco Mamei and Franco Zambonelli. Programming pervasive and mobile computing applications with the TOTA middleware. In Pervasive Computing and Communications, 2004, pages 263-273. IEEE, 2004. URL:
  41. Yuanqiu Mo, Jacob Beal, and Soura Dasgupta. An aggregate computing approach to self-stabilizing leader election. In International Workshops on Foundations and Applications of Self* Systems (FAS*W), pages 112-117. IEEE, 2018. URL:
  42. Christine Morin and Isabelle Puaut. A survey of recoverable distributed shared virtual memory systems. IEEE Trans. Parallel Distributed Syst., 8(9):959-969, 1997. URL:
  43. Hamid Mushtaq, Zaid Al-Ars, and Koen Bertels. Survey of fault tolerance techniques for shared memory multicore/multiprocessor systems. In International Design and Test Workshop (IDT), pages 12-17. IEEE, 2011. URL:
  44. Ryan Newton and Matt Welsh. Region streams: Functional macroprogramming for sensor networks. In Workshop on Data Management for Sensor Networks, pages 78-87, 2004. URL:
  45. Torsten Hoefler on behalf of the MPI Forum. MPI: A message-passing interface standard, version 2.2. Specification, Message Passing Interface Forum, September 2009. URL:
  46. H. Van Dyke Parunak, Sven Brueckner, Robert S. Matthews, and John A. Sauter. Pheromone learning for self-organizing agents. IEEE Trans. Syst. Man Cybern. Part A, 35(3):316-326, 2005. URL:
  47. Rajiv Ranjan, Omer F. Rana, Surya Nepal, Mazin Yousif, Philip James, Zhenya Wen, Stuart L. Barr, Paul Watson, Prem Prakash Jayaraman, Dimitrios Georgakopoulos, Massimo Villari, Maria Fazio, Saurabh Kumar Garg, Rajkumar Buyya, Lizhe Wang, Albert Y. Zomaya, and Schahram Dustdar. The next grand challenges: Integrating the internet of things and data science. IEEE Cloud Comput., 5(3):12-26, 2018. URL:
  48. Mirko Viroli, Giorgio Audrito, Jacob Beal, Ferruccio Damiani, and Danilo Pianini. Engineering resilient collective adaptive systems by self-stabilisation. ACM Trans. Model. Comput. Simul., 28(2):16:1-16:28, 2018. URL:
  49. Mirko Viroli, Jacob Beal, Ferruccio Damiani, Giorgio Audrito, Roberto Casadei, and Danilo Pianini. From distributed coordination to field calculus and aggregate computing. J. Log. Algebraic Methods Program., 109, 2019. URL:
  50. Pascal Weisenburger, Mirko Köhler, and Guido Salvaneschi. Distributed system development with ScalaLoci. Proc. ACM Program. Lang., 2(OOPSLA):129:1-129:30, 2018. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail