API reference · Benchmarks · Stdlib Benchmarks
Picos is a systems programming interface between effects based schedulers and concurrent abstractions. Picos is designed to enable an ecosystem of interoperable elements of effects based cooperative concurrent programming models such as
- schedulers that multiplex large numbers of user level fibers to run on a small number of system level threads,
- mechanisms for managing fibers and for structuring concurrency,
- communication and synchronization primitives, such as mutexes and condition variables, message queues, STMs, and more, and
- integrations with low level asynchronous IO systems.
The picos
package is divided into many small(er) libraries. The core is a
small library,
picos
,
that defines the essential scheduler interface. The rest of the libraries are
either sample schedulers (e.g.
picos.fifos
,
picos.lwt
,
picos.randos
,
and
picos.threaded
),
scheduler agnostic libraries (e.g.
picos.structured
,
picos.sync
,
picos.stdio
,
and
picos.select
),
or auxiliary libraries.
There are already several concrete effects-based concurrent programming libraries and models being developed. Here is a list of some such publicly available projects:*
- Affect — "Composable concurrency primitives with OCaml effects handlers (unreleased)",
- Domainslib — "Nested-parallel programming",
- Eio — "Effects-Based Parallel IO for OCaml",
- Fuseau — "Lightweight fiber library for OCaml 5",
- Miou — "A simple scheduler for OCaml 5",
- Moonpool — "Commodity thread pools for OCaml 5", and
- Riot — "An actor-model multi-core scheduler for OCaml 5".
All of the above libraries are mutually incompatible with each other with the exception that Domainslib, Eio, and Moonpool implement an earlier interoperability proposal called domain-local-await or DLA, which allows a concurrent programming library like Kcas* to work on all of those. Unfortunately, DLA, by itself, is known to be insufficient and the design has not been universally accepted.
By introducing a scheduler interface and key libraries, such as an IO library, implemented on top of the interface, we hope that the scarce resources of the OCaml community are not further divided into mutually incompatible ecosystems built on top of such mutually incompatible concurrent programming libraries, while, simultaneously, making it possible to experiment with many kinds of concurrent programming models.
It should be technically* possible to
- make all of the previously mentioned libraries Picos compatible, i.e. to handle the Picos effects, and
- have their elements implemented in Picos, i.e. to make them usable on other Picos-compatible schedulers.
Please read the reference manual for further information.