package dscheck
Traced Atomics
Install
Authors
Maintainers
Sources
dscheck-0.1.1.tbz
sha256=192b0c7a3d1d48ba7b9a7884a7fb5406ad8b82094ca2f7aac87d3183aee9bcd4
sha512=88587787c9e7537061ae7cb19268a86eab88bfb3a749efd7e41ef4d5423495b1bbd23185e6e13ed3486f41b8bba6a16c01320a20b77567592739cceddf175584
Description
Published: 14 Mar 2023
README
dscheck
— tool for testing concurrent OCaml programs
Experimental model checker for testing concurrent algorithms based on Dynamic Partial-Order Reduction for Model Checking Software. At the core, dscheck
runs each test numerous times, exhaustively trying every single interleaving of atomic operations. User-provided assertions are run at the end of every execution.
Usage
Dscheck can be installed from opam
: opam install dscheck
. Sample usage on a naive counter is shown below.
module Atomic = Dscheck.TracedAtomic
(* tested implementation needs to use dscheck's atomic module *)
let test_counter () =
let counter = Atomic.make 0 in
let incr () = Atomic.set counter (Atomic.get counter + 1) in
Atomic.spawn incr;
Atomic.spawn incr;
Atomic.final (fun () -> Atomic.check (fun () -> Atomic.get counter == 2))
This is a classic example of a race condition with two threads trying to increment a counter without synchronisation. When the race occurs, one of the updates is lost. dscheck
finds the interleaving that leads to that:
Found assertion violation at run 12:
Process 0: start
Process 0: get 1
Process 1: start
Process 1: get 1
Process 0: set 1
Process 1: set 1
Fatal error: exception File "src/tracedAtomic.ml", line 266, characters 6-12: Assertion failed
Contributions
Contributions are appreciated! Please create issues/PRs to this repo.
Dependencies (4)
- oseq
- containers
-
dune
>= "2.9"
-
ocaml
>= "5.0.0"
Used by (4)
-
eio
>= "0.8.1"
-
lockfree
>= "0.3.0"
- saturn
- saturn_lockfree
Conflicts
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page