Effect-dependent transformations for concurrent programs

Nick Benton , Martin Hofmann and Vivek Nigam

Sci. Comput. Program., 155:27–51

2018 · doi: 10.1016/j.scico.2017.11.001

abstract

We describe a denotational semantics for an abstract effect system for a higher-order,shared-variable concurrent programming language. We prove the soundness of a numberof general effect-based program equivalences, including a parallelization equationthat specifies sufficient conditions for replacing sequential composition with parallelcomposition. Effect annotations are relative to abstract locations specified by contractsrather than physical footprints allowing us in particular to show the soundness of sometransformations involving fine-grained concurrent data structures, such as MichaelScottqueues, that allow concurrent access to different parts of mutable data structures.Our semantics is based on refining a trace-based semantics for first-order programsdue to Brookes. By moving from concrete to abstract locations, and adding type refinementsthat capture the possible side-effects of both expressions and their concurrentenvironments, we are able to validate many equivalences that do not hold in an unrefinedmodel. The meanings of types are expressed using a game-based logical relationover sets of traces. Two programs e1 and e2 are logically related if one is able to solvea two-player game: for any trace with result value v1 in the semantics of e1 (challenge)that the player presents, the opponent can present an (response) equivalent trace in thesemantics of e2 with a logically related result value v2.

url: https://doi.org/10.1016/j.scico.2017.11.001