一句话:提出首个面向 Rust 的安全间歇计算类型系统 Curricle,用信息流与类型限定符表达并检查幂等性要求。
无电池能量采集设备可在难以触及的环境中计算,但代价是可编程性与正确性:设备随能量供给间歇运行,依赖恢复系统保存与恢复状态。部分程序任务必须在断电意义上原子执行,未完成则需重执行,而重执行通常应保持幂等(行为与单次执行一致)。因此正确间歇执行的关键在于识别并恢复导致非期望非幂等的状态。已有间歇系统采用临时方案:不可靠的数据流分析,或保守地恢复所有被写入状态;且没有工作允许程序员直接指定幂等性需求(包括允许的非幂等)。本文提出 Curricle——首个针对 Rust 的安全间歇性类型系统方法。类型级推理使程序员能够表达需求,并保留对可靠分析至关重要的别名信息;Curricle 使用信息流与类型限定符拒绝会造成非期望非幂等的程序。作者在 Rust 编译器之上实现该类型系统原型,并在以往工作的基准程序上评估,发现 Curricle 既让应用程序员表达并被检查其幂等性要求,也使经其检查的程序帮助间歇系统设计者写出更简单、性能更好的恢复系统。
Batteryless energy-harvesting devices enable computing in inaccessible environments, at a cost to programmability and correctness. These devices operate intermittently as energy is available, using a recovery system to save and restore state. Some program tasks must execute atomically w.r.t. power failures, re-executing if power fails before completion. Any re-execution should typically be idempotent —its behavior should match the behavior of a single execution. Thus, a key aspect of correct intermittent execution is identifying and recovering state causing undesired non-idempotence. Unfortunately, past intermittent systems take an ad-hoc approach, using unsound dataflow analyses or conservatively recovering all written state. Moreover, no prior work allows the programmer to directly specify idempotence requirements (including allowable non-idempotence). We present curricle, the first type system approach to safe intermittence, for Rust. Type level reasoning allows programmers to express requirements and retains alias information crucial for sound analyses. Curricle uses information flow and type qualifiers to reject programs causing undesired non-idempotence. We implement Curricle’s type system on top of Rust’s compiler, evaluating the prototype on benchmarks from prior work. We find that Curricle benefits application programmers by allowing them to express idempotence requirements that are checked to be satisfied, and that targeting programs checked with Curricle allows intermittent system designers to write simpler recovery systems that perform better.
@article{paperbot1938,
title = {A Type System for Safe Intermittent Computing},
author = {Milijana Surbatovich and Naomi Spargo and Limin Jia and Brandon Lucia},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {PLDI},
year = {2023},
doi = {10.1145/3591250}
}