Lwc: Light Weight Concurrency in OCaml

We explore various methods to implement (very) light weight concurrency in OCaml, allowing to manage thousands or even millions of threads:

The first two methods allow to write applications in “normal” direct style, while the other require applications to be written in indirect style.

We try to examine the relations between these various methods. 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 “trampolined” method seems to be the best both at CPU and memory requirements.

This document was translated from LATEX by HEVEA.