kirancodes.me
To Proof Maintenance & Beyond!

A graded Monad for deadlock-free concurrency (functional pearl)

Andrej Ivašković, Alan Mycroft

Abstract

We present a new type-oriented framework for writing shared memory multithreaded programs that the Haskell type system guarantees are deadlock-free. The implementation wraps all concurrent computation inside a graded monad and assumes a total order is defined between locks. The grades within the type of such a computation specify which locks it acquires and releases. This information is drawn from an algebra that ensures that types can, in principle, be inferred in polynomial time.

Related papers