Light Weight Concurrency in OCaml:
Continuations, Monads, Promises, Events

Christophe Deleuze

September 2011

Abstract: We explore various methods to implement (very) light weight concurrency in OCaml, in both direct and indirect style. We try in particular to examine the relations between all these various schemes. Three simple example applications allow us to examine both the coding styles and the performances. The cost of context switching, thread creation and the memory footprint of a thread are compared. All implementations are much better than system and VM threads, but the “trampoline” scheme seems to be the best both at CPU and memory requirements.

This document was translated from LATEX by HEVEA.