dejafu: Systematic testing for Haskell concurrency.

[ concurrency, library, mit ] [ Propose Tags ]

[Déjà Fu is] A martial art in which the user's limbs move in time as well as space, […] It is best described as "the feeling that you have been kicked in the head this way before" -- Terry Pratchett, Thief of Time

Concurrency is nice, deadlocks and race conditions not so much. The Par monad family, as defined in abstract-par provides deterministic parallelism, but sometimes we can tolerate a bit of nondeterminism.

This package builds on the concurrency package by enabling you to systematically and deterministically test your concurrent programs.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.3.1.1, 0.3.2.0, 0.3.2.1, 0.4.0.0, 0.5.0.0, 0.5.0.2, 0.5.1.0, 0.5.1.1, 0.5.1.2, 0.5.1.3, 0.6.0.0, 0.7.0.0, 0.7.0.1, 0.7.0.2, 0.7.1.0, 0.7.1.1, 0.7.1.2, 0.7.1.3, 0.7.2.0, 0.7.3.0, 0.8.0.0, 0.9.0.0, 0.9.0.1, 0.9.0.2, 0.9.0.3, 0.9.1.0, 0.9.1.1, 0.9.1.2, 1.0.0.0, 1.0.0.1, 1.0.0.2, 1.1.0.0, 1.1.0.1, 1.1.0.2, 1.2.0.0, 1.3.0.0, 1.3.0.1, 1.3.0.2, 1.3.0.3, 1.3.1.0, 1.3.2.0, 1.4.0.0, 1.5.0.0, 1.5.1.0, 1.6.0.0, 1.7.0.0, 1.8.0.0, 1.9.0.0, 1.9.1.0, 1.10.0.0, 1.10.1.0, 1.11.0.0, 1.11.0.1, 1.11.0.2, 1.11.0.3, 1.11.0.4, 1.11.0.5, 1.12.0.0, 2.0.0.0, 2.0.0.1, 2.1.0.0, 2.1.0.1, 2.1.0.2, 2.1.0.3, 2.2.0.0, 2.3.0.0, 2.3.0.1, 2.4.0.0, 2.4.0.1, 2.4.0.2, 2.4.0.3, 2.4.0.4, 2.4.0.5 (info)
Change log CHANGELOG.markdown
Dependencies base (>=4.8 && <5), concurrency (>=1.1 && <1.3), containers (>=0.5 && <0.6), deepseq (>=1.1 && <2), exceptions (>=0.7 && <0.9), leancheck (>=0.6 && <0.7), random (>=1.0 && <1.2), ref-fd (>=0.4 && <0.5), semigroups (>=0.16 && <0.19), transformers (>=0.4 && <0.6), transformers-base (>=0.4 && <0.5) [details]
License MIT
Author Michael Walker
Maintainer mike@barrucadu.co.uk
Category Concurrency
Home page https://github.com/barrucadu/dejafu
Source repo head: git clone https://github.com/barrucadu/dejafu.git
this: git clone https://github.com/barrucadu/dejafu.git(tag dejafu-0.9.1.0)
Uploaded by barrucadu at 2017-11-26T22:54:49Z
Distributions LTSHaskell:2.4.0.5, NixOS:2.4.0.5, Stackage:2.4.0.5
Reverse Dependencies 7 direct, 26 indirect [details]
Downloads 44616 total (114 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-11-26 [all 1 reports]

Readme for dejafu-0.9.1.0

[back to package description]

dejafu

[Déjà Fu is] A martial art in which the user's limbs move in time as well as space, […] It is best described as "the feeling that you have been kicked in the head this way before"

-- Terry Pratchett, Thief of Time

Concurrency is nice, deadlocks and race conditions not so much. The Par monad family, as defined in abstract-par provides deterministic parallelism, but sometimes we can tolerate a bit of nondeterminism.

This package builds on the concurrency package (also in this repository) by enabling you to systematically and deterministically test your concurrent programs.

The documentation of the latest developmental version is available online. Examples can be found in the test suite.

Note on the test suite: This is in a separate project (dejafu-tests) because Cabal-the-library is a bit naff. See this issue.

Déjà Fu and IO

The core assumption underlying Déjà Fu is that any apparent nondeterminism arises purely from the scheduling behaviour. To put it another way, a given computation, parametrised with a fixed set of scheduling decisions, is deterministic.

Whilst this assumption may not hold in general when IO is involved, you should strive to produce test cases where it does.

Memory Model

The testing functionality supports a few different memory models, for computations which use non-synchronised CRef operations. The supported models are:

  • Sequential Consistency: A program behaves as a simple interleaving of the actions in different threads. When a CRef is written to, that write is immediately visible to all threads.

  • Total Store Order (TSO): Each thread has a write buffer. A thread sees its writes immediately, but other threads will only see writes when they are committed, which may happen later. Writes are committed in the same order that they are created.

  • Partial Store Order (PSO): Each CRef has a write buffer. A thread sees its writes immediately, but other threads will only see writes when they are committed, which may happen later. Writes to different CRefs are not necessarily committed in the same order that they are created.

If a testing function does not take the memory model as a parameter, it uses TSO.

Contributing

Bug reports, pull requests, and comments are very welcome!

Feel free to contact me on GitHub, through IRC (#haskell on freenode), or email (mike@barrucadu.co.uk).