Composing Schedulers using Effect Handlers
OCaml 5 introduces effect handlers as a mechanism for con- current programming. With effect handlers, concurrency can be expressed in direct-style rather than in monadic-style as in Lwt and Async. Rather than baking in the notion of a thread scheduler, the compiler exposes delimited continuations, with the idea that different libraries may implement their own concurrency primitive, with their own schedulers. Under this setting, given that the notion of a concurrent task is tied to a particular scheduler, it is challenging to allow tasks from different schedulers to interact with each other. If this problem is not solved, the ecosystem runs the risk of repeating the schism between Lwt and Async in OCaml today.
In this paper, we observe that the composability of effect handlers permits composability of schedulers. The key idea is that we can use effect handlers to define a uniform interface for suspending and resuming tasks, which is implemented by each of the schedulers. On top of this, we define scheduler-agnostic synchronization structures that allow tasks from different schedulers to interact. We also report on how this mechanism can be extended to capture the notion of task cancellation that extends across different schedulers
Fri 16 SepDisplayed time zone: Belgrade, Bratislava, Budapest, Ljubljana, Prague change
09:00 - 10:30 | |||
09:00 50mKeynote | OCaml 5.0 - Concurrent and Parallel programming for OCaml OCaml KC Sivaramakrishnan IIT Madras and Tarides Media Attached | ||
09:50 20mTalk | Multicoretests - Parallel Testing Libraries for OCaml 5.0 OCaml | ||
10:10 20mTalk | Composing Schedulers using Effect Handlers OCaml Pre-print |