article Open access

Data Race Freedom à la Mode

  • Proceedings of the ACM on Programming Languages
  • Association for Computing Machinery
Research footprint

At a glance

Citations
4
References
27
Comments
0
Paper overview

Abstract

We present DRFCaml, an extension of OCaml’s type system that guarantees data race freedom for multithreaded OCaml programs while retaining backward compatibility with existing sequential OCaml code. We build on recent work of Lorenzen et al., who extend OCaml with modes that keep track of locality, uniqueness, and affinity. We introduce two new mode axes, contention and portability , which record whether data has been shared or can be shared between multiple threads. Although this basic type-and-mode system has limited expressive power by itself, it does let us express APIs for capsules , regions of memory whose access is controlled by a unique ghost key, and reader-writer locks , which allow a thread to safely acquire partial or full ownership of a key. We show that this allows complex data structures (which may involve aliasing and mutable state) to be safely shared between threads. We formalize the complete system and establish its soundness by building a semantic model of it in the Iris program logic on top of the Rocq proof assistant.

Record transparency

Publication details

DOI
10.1145/3704859
OpenAlex
W4406222012
Document type
article
Language
EN
Source
Proceedings of the ACM on Programming Languages
Last metadata update
Community

Comments

Log in to join the discussion.

  1. No comments yet. Start the discussion.