package kcas_data

  1. Overview
  2. Docs
Compositional lock-free data structures and primitives for communication and synchronization

Install

Dune Dependency

Authors

Maintainers

Sources

kcas-0.5.0.tbz
sha256=098ce4a218d056de19124cfe2a3bb4fe611467adb65325bbe5ce18ae05cd0cdc
sha512=1c96a9eb0230d9a9134fab358cb6e5112c51e912d3000f777256d5610fa3834d52ecb58843efe1dbb212440d233dca28f62d69665f9b86332c7ae5ae03f7f2ad

doc/kcas_data/Kcas_data/index.html

Module Kcas_dataSource

This package provides a collection of compositional lock-free data structures with in-place modification.

All data structure implementations in this library should strive to provide the following guarantees:

  • Provided operations are strictly serializable (i.e. both linerizable and serializable).
  • Provided operations are efficient, either (amortized) constant time, O(1), or logarithmic time, O(log(n)).
  • Provided operations are lock-free and designed to avoid starvation under moderate contention.
  • Provided read-only operations scale perfectly when only read-only operations are performed in parallel.

Unobvious exceptions to the above guarantees should be clearly and explicitly documented.

The main feature of these data structure implementations is their compositionality. For example, one can easily compose a transaction to atomically transfer a value from a Queue to a Stack:

  let tx ~xt =
    match Queue.Xt.take_opt ~xt queue with
    | None -> ()
    | Some value ->
      Stack.Xt.push ~xt stack value
  in
  Xt.commit { tx }

If your application does not need compositionality, then other domain safe data structure libraries may potentially offer better performance.

Stdlib style data structures

The data structures in this section are designed to closely mimic the corresponding unsynchronized data structures in the OCaml Stdlib. Each of these provide a non-compositional, but domain safe, interface that is close to the Stdlib equivalent. Additionally, compositional transactional interfaces are provided for some operations.

These implementations will use more space than the corresponding Stdlib data structures. Performance, when accessed concurrently, should be competitive or superior compared to naïve locking.

Sourcemodule Hashtbl : sig ... end

Hash table.

Sourcemodule Queue : sig ... end

First-In First-Out (FIFO) queue.

Sourcemodule Stack : sig ... end

Last-In First-Out (LIFO) stack.

Communication and synchronization primitives

Sourcemodule Promise : sig ... end

A promise of a value to be resolved at some point in the future.

Linked data structures

Sourcemodule Dllist : sig ... end

Doubly-linked list.

Utilities

Sourcemodule Accumulator : sig ... end

Scalable accumulator.

OCaml

Innovation. Community. Security.