Hi there,
I'd like to announce the availability of an user-space implementation of STM
library for OCaml. The library is still in its alpha stage, and currently has
just one back-end (for threads). You're welcome to try it and send
feedback. Bugs report and suggestions will be appreciated.
The address is
http://www.pps.jussieu.fr/~li/software/index.html#stmlib ,
where you can find all the sources, examples and documents.
best regards
- li
Here is some paragraphs from the README:
-----------------------------------------------------------------------------
DESCRIPTION
===========
This is a user-space implementation of STM (Software Transactional Memory)
library for OCaml. It's mainly inspired by the STM library of Haskell (you may
want to read some of the references in the REFERENCE section), with some
exceptions due to the different nature of languages and the different
strategies of implementation.
- This library is a user level implementation, whereas the Haskell version is
based on primitives built into the runtime.
- This library is purely an add-on to the already existed concurrent library
of standard OCaml: threads, processes (TODO) and network programs
(TODO). I.e. you can still program your concurrent applications with all
facilities already exist in OCaml (such as Thread.create or Unix.fork to
launch new thread/process respectively), but with the functions from this
library you may transactionally read/write shared data instead of using
locks or messages (and you may mix them if you really want).
- There are subtle differences on the signatures and semantics of some
specific functions between this library and the Haskell version. They are
documented in the library manual.
Currently only the threads back-end is provided as a proof of concept. Other
back-ends, which share the exact interface, will come out some time later. With
the help of iThread module (a minimal common interface for launching and
manipulating threads/process/network programs with uniformed functions, having
a naive implemented and not publicly available at this moment), you will be
able to write a single program (.ml) and compile once (.cmo), but link with
different backends to get different excutables based on different execution
model (threaded, multi-process and networked).
REFERENCE
=========
The following literature is helpful on understanding STM. The first one is
especially recommended from a programmer's (library user) point of view.
- Beautiful concurrency: a practical illustration of STM
<
http://research.microsoft.com/~simonpj/papers/stm/#beautiful>
- STM paper: rigorous semantics definition of STM in Haskell
<
http://research.microsoft.com/~simonpj/papers/stm/#composble>
- Haskell wiki page on STM
<
http://www.haskell.org/haskellwiki/Software_transactional_memory>