• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    OCaml
  • License
    MIT License
  • Created about 1 year ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 ())))
  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.

More Repositories

1

tldr.jsx

📚 A Reactive web client for tldr-pages
JavaScript
1,547
star
2

caramel

🍬 a functional language for building type-safe, scalable, and maintainable applications
OCaml
1,050
star
3

reason-design-patterns

🗺 An unofficial collection of "design patterns" for ReScript, Reason, and OCaml
Reason
477
star
4

minttea

A fun little TUI framework for OCaml
OCaml
315
star
5

lam

🚀 a lightweight, universal actor-model vm for writing scalable and reliable applications that run natively and on WebAssembly
Rust
250
star
6

httpkit

⚡️ High-level, High-performance HTTP(S) Clients/Servers in Reason/OCaml
OCaml
202
star
7

serde.ml

Serialization framework for OCaml
OCaml
109
star
8

ng2

📐 minimalistic modular angular.js app generator (outdated as of Dec 1st, 2013)
JavaScript
95
star
9

awesome-alt-langs

Just a list of Awesome Alt Langs to check out
82
star
10

reactor

🚀 Native Actors for Reason and OCaml
OCaml
70
star
11

cactus

🌵A composable static site generator
Reason
65
star
12

atacama

Modern, pure OCaml socket pool for Riot
OCaml
37
star
13

scarab

Benchmarking framework for OCaml
OCaml
24
star
14

pachadb

an edge database
Rust
24
star
15

trail

Minimal composable server framework for Riot
OCaml
24
star
16

blink

A pure OCaml HTTP client for Riot
OCaml
23
star
17

tty

A pure OCaml library for working with terminals
OCaml
22
star
18

hotstuff

🔥 Composable, incremental, turnkey document compiler
Rust
21
star
19

colors

A pure OCaml library for manipulating colors in different color spaces.
OCaml
20
star
20

watch

⌚ A portable Go alternative to GNU's watch – very useful for autorunning things!
Go
19
star
21

rules_reason

📐Reason/OCaml rules and tools for Bazel
Python
19
star
22

nomad

Pure OCaml HTTP 1.1/2 & WebSocket server for Riot
Elixir
19
star
23

mlx

OCaml
18
star
24

mesa

A modern, idiomatic web framework for Riot
OCaml
16
star
25

tldr.js

Old version now mirroring React-client, please go to
JavaScript
16
star
26

ocaml-grpc

A gRPC implementation written in pure OCaml/Reason
OCaml
16
star
27

dotfiles

💾 ~/.*
Python
14
star
28

q-lang

Rust
14
star
29

react-useMailbox

📫 A small React hook to turn your components into "Actors".
JavaScript
13
star
30

chatty

a TUI app for chatting on Twitch
OCaml
12
star
31

telemetry

Lightweight event dispatching for OCaml.
OCaml
11
star
32

Bakery

CoffeeScript, Backbone, RequireJS, HeadJs and Jasmine. All together.
JavaScript
11
star
33

Expresso

CoffeeScript compiling for Pythonistas.
Python
10
star
34

hooke

Spring-based animation library for OCaml
OCaml
10
star
35

config.ml

conditional compilation via attributes for OCaml
OCaml
10
star
36

castore

A portable pure OCaml CA Store
OCaml
10
star
37

loop

Unbounded loops with early breaks and continues for OCaml 5.
OCaml
9
star
38

mixtape

🎧 🔄 Synchronised Playlist Playback for Spotify
JavaScript
8
star
39

oak

🌳 A minimalistic Tree-like tool built in Reason Native
OCaml
8
star
40

bazaar

find anything you need in ocaml
OCaml
8
star
41

twitchboard

📺 Real-time Stream Stats Tool for Twitch.tv
OCaml
7
star
42

idris-coda

📦 A collection of Idris packages
Idris
6
star
43

blast64

⚡ An apparently even faster base64 decoder for Chrome
HTML
6
star
44

fuzzql

⚙️ A GraphQL Fuzzy Testing Toolkit
OCaml
6
star
45

servus

A static-file server written with http/af + Reason Native
OCaml
6
star
46

erlang-gui

An experiment in building high-performance, native graphical user interfaces in Erlang
Erlang
6
star
47

woolly

a little mastodon client
TypeScript
6
star
48

wittgenstein

📚 A semantic, real-time, distributed, knowledge base.
Erlang
5
star
49

muad

🐭 a small, extensible task runner for OCaml
OCaml
5
star
50

asdf

🐛 Random code snippets
Idris
4
star
51

escheck

JavaScript
4
star
52

ng-board

a realtime dashboard
JavaScript
4
star
53

paper-eaters

📚
4
star
54

switchboard.rb

Ruby client for switchboard.spatch.co
Ruby
4
star
55

tap-idris

🍻 A simple TAP producer and consumer/reporter for Idris
Idris
4
star
56

reason-gc

🗑 A small exploration of the Reason/OCaml Garbage Collector
OCaml
4
star
57

PhantomSDL

👾 A game engine I was building when I was 14
C
3
star
58

zazen

🙏 sit, breathe, code.
JavaScript
3
star
59

jawa

OCaml
3
star
60

random

Easy-to-use, cryptographically safe random data for OCaml
OCaml
3
star
61

node-puntopagos

PuntoPagos Module for NodeJS
JavaScript
2
star
62

try

♻️ A portable Go utility to retry commands with backoff
Go
2
star
63

libra

⚖️ A Lisp Parser in Idris
Idris
2
star
64

anchorman

⚓👨 An Erlang library for broadcasting information
Erlang
2
star
65

unveil

🎬 The Reactive Javascript Presentation Library
JavaScript
2
star
66

play.app

an ember.js phonegap application
JavaScript
2
star
67

making-makefiles

A small set of koans to learn about Makefiles
Vim Script
2
star
68

rocket

following the Essentials of Compilation book in OCaml
OCaml
2
star
69

pry

🔭 An Erlang application for observing supervision trees
Erlang
2
star
70

rx-history

History Observable for RxJS
JavaScript
2
star
71

dasBlog

For blogging wasn't German enough.
Python
2
star
72

rdn

Reason Data Notation
2
star
73

ws

🔄 An erlang WebSocket server
Erlang
2
star
74

EXII-macOS

A poorly written User-land driver for the EXII USB device family
Swift
2
star
75

libc.ml

Raw bindings to platform APIs for OCaml
OCaml
2
star
76

ng-board-smoothie

smoothie graphs widget for ng-board
JavaScript
2
star
77

message.me

a sample web app built with ng2
JavaScript
1
star
78

go-go-gadget

go tests
Go
1
star
79

lisping

some lisping!
Common Lisp
1
star
80

tweet-cli

tweet from your cli
JavaScript
1
star
81

projector

📽️ Stay on top of your Github Projects
JavaScript
1
star
82

reactor-web

OCaml
1
star
83

textmine.js

Text-mining for NodeJS
1
star
84

retrie

A quick and dirty, likely broken trie
OCaml
1
star
85

ngage-platformer

angularjs based platformer game
JavaScript
1
star
86

cerebro

🔭 A simple app to track down Mutant-grade Engineers on Github
JavaScript
1
star
87

piclevel-api

JavaScript
1
star
88

transporter.io-ng-board

ng-board transport for transporter.io
JavaScript
1
star
89

transporter.io

a transport system over websockets
JavaScript
1
star
90

PlayApp

the play app!
Objective-C
1
star
91

webtail

A simple file piping over http script using connect and spawn('tail')
JavaScript
1
star
92

v-sexpr

An S-expression library for V
V
1
star
93

grunt-knox

A set of Knox tasks for GruntJS
JavaScript
1
star
94

Toasty

A Toasted game framework for the Marmalade SDK
C++
1
star
95

bsb-load-test

Just a repo building a crapload of modules
OCaml
1
star
96

anchorman.js

a reporter library for nodejs
JavaScript
1
star
97

tribble

OCaml
1
star
98

lore

A modern semantic data modelling language
Rust
1
star
99

transporter.io-events

events transport for transporter.io
JavaScript
1
star
100

cleverboard

the first project using ng-board and transporter.io
1
star