package riot

  1. Overview
  2. Docs
An actor-model multi-core scheduler for OCaml 5

Install

Dune Dependency

Authors

Maintainers

Sources

riot-0.0.9.tbz
sha256=f035f5b6ac2558794298bb7f5c7aeb73feea93e32125dc019c0aa6424b13aa8a
sha512=854ae5310d49ca863ac4ea6aa7e7f9129d5b0e3d7093ca16c42d3e5a287219745e24249ff5d00173dd0f60754fc85d98f22895f2084ec0b16c7fb35fdb5d9802

Description

Riot is an actor-model multi-core scheduler for OCaml 5. It brings Erlang-style concurrency to the language, where lighweight process communicate via message passing

README

README.md

riot logo

An actor-model multi-core scheduler for OCaml 5.

Quick Start | Tutorial | Reference   

Riot is an actor-model multi-core scheduler for OCaml 5. It brings Erlang-style concurrency to the language, where lightweight processes communicate via message-passing.

open Riot

type Message.t += Hello_world

let () =
  Riot.run @@ fun () ->
  let pid =
    spawn (fun () ->
        match receive () with
        | Hello_world ->
            Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ()));
            shutdown ())
  in
  send pid Hello_world

At its core Riot aims to offer:

  • Automatic multi-core scheduling – when you spawn a new Riot process, it will automatically get allocated on a random scheduler.

  • Lightweight processes – spawn 10 or 10,000 processes as you see fit.

  • Fast, type-safe message passing

  • Selective receive expressions – when receiving messages, you can skim through a process mailbox to consume them in arbitrary order.

  • Process links and monitors to keep track of the lifecycle of processes

Riot also includes:

  • Supervisors to build process hierarchies

  • Logging and Telemetry designed to be multicore friendly

  • an Application interface to orchestrate startup/shutdown of systems

  • Generic Servers for designing encapsulated services like with Elixir's GenServer

Non-goals

At the same time, there's a few things that Riot is not, and does not aim to be.

Primarily, Riot is not a full port of the Erlang VM and it won't support several of its use-cases, like:

  • supporting Erlang or Elixir bytecode

  • hot-code reloading in live applications

  • function-call level tracing in live applications

  • ad-hoc distribution

Quick Start

opam install riot

After that, you can use any of the examples as a base for your app, and run them:

dune exec ./my_app.exe

Acknowledgments

Riot is the continuation of the work I started with Caramel, an Erlang-backend for the OCaml compiler.

It was heavily inspired by eio by the OCaml Multicore team and miou by Calascibetta Romain and the Robur team, as I learned more about Algebraic Effects. In particular the Proc_state is based on the State module in Miou.

And a thousand thanks to Calascibetta Romain and Antonio Monteiro for the discussions and feedback.

Dependencies (14)

  1. dune >= "3.11"
  2. uri >= "4.4.0"
  3. tls = "0.17.3"
  4. telemetry >= "0.0.1"
  5. rio >= "0.0.1"
  6. randomconv = "0.2.0"
  7. ptime >= "1.1.0"
  8. ocaml >= "5.1"
  9. mtime >= "2.0.0"
  10. mirage-crypto-rng >= "0.11.2"
  11. mirage-crypto >= "0.11.2"
  12. gluon >= "0.0.1"
  13. config >= "0.0.1"
  14. bytestring >= "0.0.1"

Dev Dependencies (4)

  1. x509 with-test & >= "0.16.5"
  2. odoc with-doc & >= "2.2.2"
  3. mdx with-test & >= "2.3.1"
  4. castore with-test & >= "0.0.2"

Used by (4)

  1. atacama >= "0.0.5"
  2. minttea < "0.0.2"
  3. nomad
  4. trail

Conflicts

None