Talk: 11:05–11:50 (English)
Deterministic Concurrency in Rust: Policy Based Scheduling
Rust guarantees memory safety: safe code has no data races. It does not guarantee determinism. Two threads that share a flag, one setting it and one testing it, may see each other in either order, and the program’s result depends on the scheduler.
Synchronous languages such as Esterel obtain determinism with a logical clock and a fixed rule: within a tick, every write of a signal comes before every read. The rule works, but it is too strict for general shared state. The policy theory of clock-synchronised shared memory, developed by Mendler, Pouzet and colleagues, lifts this restriction: each shared object declares its own policy, which operations are allowed and which must come before which. If the objects respect a simple coherence condition, every schedule gives the same result.
Rust is a natural home for this theory. Its type system already rules out data races, so the only remaining source of nondeterminism is the order of operations on shared objects, which is exactly what a policy controls. rpbs is our implementation of policy-based scheduling in Rust: threads share state only through policy objects, and the library orders their operations according to the policies. Also its Macro enables us to access and analyze written code at compile time which helps with extracting potentials.
The talk introduces the idea of policies, shows how it carries over from theory into Rust, and what we gain: Rust programs that are memory safe and deterministic.
Majid Babaeifar
https://www.linkedin.com/in/majidbabaeifar/
Majid Babaeifar is a software engineer with eight years of experience building distributed, high-availability, low-latency systems. At the University of Bamberg, Majid wrote a master’s thesis under Prof. Michael Mendler on bringing policy-based scheduling to Rust, which led to the rpbs library and a paper on its formal semantics. Majid writes about software architecture and engineering fundamentals at majidbabaeifar.com.