对邻居的计算:使用函数式编程和Scala解决大规模分布与自适应性问题
Computation Against a Neighbour: Addressing Large-Scale Distribution and Adaptivity with Functional Programming and Scala
AI总结:
针对大规模分布式系统编程中邻居交互的复杂性,本文提出“对邻居的计算”概念,基于邻居演算(NC)简化聚合编程,并通过Scala实现ScaFi验证其表达力。
摘要:
在物联网(IoT)和大规模信息物理系统(CPS)等背景下,近期工作提出了通过关注分布式系统在空间和时间上的全局行为来编程分布式系统的理念。在这种观点下,一个潜在庞大且异构的设备集合被视为一个“聚合体”,作为一个整体进行编程,同时抽象掉个体行为和消息交换的细节,这些细节以声明式方式表达。这种被称为聚合编程的范式,建立在受场协调启发的计算模型之上。诸如场演算之类的现有模型通过所谓的“邻居场”(从邻居到值的映射)来捕获与邻居的交互。这需要特殊的机制来平滑地与标准值组合,从而使聚合程序、库和领域特定语言(DSL)的编程复杂化并引入杂乱。为了解决这一关键问题,我们引入了“对邻居的计算”这一新概念,即聚合程序的某些子表达式的评估受到邻居中最近相应评估的影响。我们在邻居演算(NC)中捕获了这一概念,这是一种新的场演算变体,被证明能平滑地支持与邻居交互的声明式规范,并相应地促进将场计算作为内部DSL嵌入到通用编程语言中——如Scala实现ScaFi所示。本文形式化了NC,将其与经典场演算进行了全面比较,并通过在ScaFi中开发的边缘计算案例研究展示了其表达能力。
英文摘要:
Recent works in contexts like the Internet of Things (IoT) and large-scale Cyber-Physical Systems (CPS) propose the idea of programming distributed systems by focussing on their global behaviour across space and time. In this view, a potentially vast and heterogeneous set of devices is considered as an "aggregate" to be programmed as a whole, while abstracting away the details of individual behaviour and exchange of messages, which are expressed declaratively. One such a paradigm, known as aggregate programming, builds on computational models inspired by field-based coordination. Existing models such as the field calculus capture interaction with neighbours by a so-called "neighbouring field" (a map from neighbours to values). This requires ad-hoc mechanisms to smoothly compose with standard values, thus complicating programming and introducing clutter in aggregate programs, libraries and domain-specific languages (DSLs). To address this key issue we introduce the novel notion of "computation against a neighbour", whereby the evaluation of certain subexpressions of the aggregate program are affected by recent corresponding evaluations in neighbours. We capture this notion in the neighbours calculus (NC), a new field calculus variant which is shown to smoothly support declarative specification of interaction with neighbours, and correspondingly facilitate the embedding of field computations as internal DSLs in common general-purpose programming languages -- as exemplified by a Scala implementation, called ScaFi. This paper formalises NC, thoroughly compares it with respect to the classic field calculus, and shows its expressiveness by means of a case study in edge computing, developed in ScaFi.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。