Re:OCaml 5.0 Multicore is out
by ghostwriter on Friday December 16, 2022 @12:00PM
(#34016969)
Multicore is there, STM instead of mutable imperative logic in all the libraries developed for the past two decades: not so much though.
[ Parent
| on HN ]
I haven't heard anyone talk about STM for OCaml, funny. People talk about, or work on, lightweight fibers, lockfree data structures, io_uring, etc. but not STM. Is it falling out of fashion? Even in clojure I hear that few people actually use it.
Re:OCaml 5.0 Multicore is out
by grumpyprole on Friday December 16, 2022 @06:26PM
(#34022068)
It works great in Haskell. The problem is that it really needs typed effects, hopefully OCaml will get typed algebraic effects at some point.
Still early days, but I had done some exploratory work in the past on Reagents, a composable lock-free library [1]. Now that OCaml 5 is released, we're reviving this work.
It's semantics is weaker than STM -- unlike STM, it doesn't provide serializability but Reagents can compile down to multi-word compare and swap operations, which can be implemented with the help of hardware transactions (when present) or efficient software implementations of it [2]. Hence, Reagent programs should be faster than STM.
[1] https://github.com/ocaml-multicore/reagents [2] https://arxiv.org/pdf/2008.02527.pdf