Curry On
June 19-20th, 2017

Channels, Concurrency, and Cores: A new Concurrent ML implementation
Andy Wingo
Igalia, S.L.



What kinds of communication facilities should a programming environment support in highly concurrent systems? In the last decade or so, systems inspired by Communicating Sequential Processes (CSP) have gained a lot of mindshare from Go to Clojure’s core.async and beyond. But most these CSP-inspired systems miss some of the defining characteristics of CSP, notably the notion of choice around a rendezvous. These languages’ "select" primitive is too low-level to build abstractions around communication; it’s as if you can only communicate via the equivalent of "goto" instead of procedure call. There is a better way. Twenty years ago, Concurrent ML solved this problem comprehensively. Its "event" system has been since ported to many other systems, but has seen limited success when also scaling to multi-core environments. There was a "parallel CML" implemented in Manticore but one rarely hears reports of porting to other systems. This talk presents a port of multicore CML to Guile Scheme’s "Fibers" library, a lightweight threading facility supporting I/O concurrency and multicore parallelism. Guile’s implementation of CML is lockless, enabling near-linear scaling as more cores are made available to the system. Guile’s CML implementation is also built entirely as a library, in terms of delimited rather than undelimited continuations. We present performance numbers and an experience report for this new application of CML in the wild.


Andy has been working on programming languages for the last decade or so, from JavaScript implementations in Chrome and Firefox to Guile Scheme. He is delighted and relieved to have finally gotten the new compiler and virtual machine in Guile 2.2 released earlier this year. He was always ashamed though that Guile didn’t have any good concurrency story other than "here are some POSIX threads", and indeed only learned of Concurrent ML at last year’s Curry On. One year of hacks later, here we are!