dejafu-0.9.0.0: Systematic testing for Haskell concurrency.

Copyright (c) 2016 Michael Walker MIT Michael Walker experimental portable Safe Haskell2010

Test.DejaFu.Schedule

Description

Scheduling for concurrent computations.

Synopsis

# Scheduling

newtype Scheduler state Source #

A Scheduler drives the execution of a concurrent program. The parameters it takes are:

1. The last thread executed (if this is the first invocation, this is Nothing).
2. The runnable threads at this point.
3. The state.

It returns a thread to execute, or Nothing if execution should abort here, and also a new state.

Since: 0.8.0.0

Constructors

data Decision Source #

Scheduling decisions are based on the state of the running program, and so we can capture some of that state in recording what specific decision we made.

Since: 0.5.0.0

Constructors

 Start ThreadId Start a new thread, because the last was blocked (or it's the start of computation). Continue Continue running the last thread for another step. SwitchTo ThreadId Pre-empt the running thread, and switch to another.

Instances

 Source # Methods Source # MethodsshowList :: [Decision] -> ShowS # Source # Since: 0.5.1.0 Methodsrnf :: Decision -> () #

Get the resultant thread identifier of a Decision, with a default case for Continue.

Since: 0.5.0.0

Arguments

Get the Decision that would have resulted in this thread identifier, given a prior thread (if any) and list of runnable threads.

Since: 0.5.0.0

data NonEmpty a :: * -> * #

Non-empty (and non-strict) list type.

Since: 4.9.0.0

Constructors

 a :| [a] infixr 5

Instances

## Preemptive

A simple random scheduler which, at every step, picks a random thread to run.

Since: 0.8.0.0

A round-robin scheduler which, at every step, schedules the thread with the next ThreadId.

Since: 0.8.0.0

## Non-preemptive

A random scheduler which doesn't preempt the running thread. That is, if the last thread scheduled is still runnable, run that, otherwise schedule randomly.

Since: 0.8.0.0

A round-robin scheduler which doesn't preempt the running thread.

Since: 0.8.0.0

# Utilities

Turn a potentially preemptive scheduler into a non-preemptive one.

Since: 0.8.0.0