https://github.com/ocaml-multicore/picos
- It is an interface:
Libraries & Applications '' Schedulers ''
https://github.com/ocaml-multicore/picos
Libraries & Applications '' Schedulers ''
For a long time OCaml has supported lightweight threads exposed via the Thread module. These threads are often called “systhreads”, but I will simply call them “threads” in this post.
The OCaml Stdlib also provides many mutable data structures such as Hashtbl, Queue, and Stack. As the documentation alerts, none of these are thread-safe.
Let me first quote a paragraph from the Memory Representation of Values (with my emphasis):
Obj is an undocumented module that exposes the internals of the OCaml compiler and runtime. It is very useful for
build |
Currently OCaml 5 provides a Domain.DLS module for domain-local storage.
Unfortunately,
there is no corresponding Thread.TLS for (sys)thread-local storage, and
the current implementation of Domain.DLS is not thread-safe.
(* Copyright (c) 2023 Vesa Karvonen | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted, provided that the above | |
copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
Logistics team held a "learning day" on Thursday 2021-03-04 where we could spend one full day on a project or tutorial of our choosing. I worked on a little proof-of-concept project I dubbed ReDiSL or Redis DSL. This is a little writeup on the topic.
The motivation for working on the Redis DSL or ReDiSL was that it could make for a nice way to work with Redis especially when one is doing
Any functional data structure can be turned into a lock-free data structure by
wrapping it inside an Atomic
. For example, consider the following set
implementation:
module Identity_set : sig
type 'a t
val empty : 'a t