meta-par-0.3: Provides the monad-par interface, but based on modular scheduler "mix-ins".

Safe HaskellSafe-Infered



This module implements exponential backoff so as to prevent spamming of steal actions. This is always a good idea, and especially so in the distributed case where steal attempts send actual messages.

Normally backoff functionality is baked into the scheduler loop. One nice aspect of the Meta scheduler design is that backoff can become just another resource. Most schedulers (compositions) should include this at tho bottom of their stack.



mkWorkSearch :: Word64 -> Word64 -> WorkSearchSource

To construct a WorkSearch we need to know the minimum and maximum amount of time (nanoseconds) to sleep. The exponential backoff policy is always the same: it starts at 1ns and doubles.

The thing that changes over time is whether sleeping actually *occurs*. For example, `mkWorkSearch 1000 100000` will not sleep for the first ten invocations (until 1024), and then will sleep an amount that doubles each time until it surpasses the maximum, at which point each sleep will be for the maximum: 100ms.