Changes between Version 9 and Version 10 of Concurrency


Ignore:
Timestamp:
Mar 29, 2006 10:12:29 AM (9 years ago)
Author:
malcolm.wallace@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Concurrency

    v9 v10  
    6666
    6767----------
     68= Terminology =
    6869
     70'''Pre-emption''' means that (1) threads have priority levels, and (2) that a
     71higher priority thread can steal the processor from a currently-running
     72lower priority thread, and (3) it can do so "immediately" it needs to,
     73without waiting for some "safe" synchronisation point.
     74By these criteria, none of the current Haskell implementations are
     75pre-emptive, because no API assigns priorities to threads.  So let's try
     76to avoid using the term.
     77
     78'''Fairness''' can be defined by two main criteria:
     79 * No runnable process will be indefinitely delayed.
     80 * No thread can be blocked indefinitely on an MVar unless another thread holds the MVar indefinitely.
     81
     82'''Non-blocking foreign call''' as commonly used, actually means a foreign call that *can* block.  As a
     83consequence of the fairness policy, one wishes to place the requirement on
     84implementations that such a blocking foreign call _should_not_
     85block progress of other Haskell threads.  The thread-nature of the
     86foreign call is "blocking".  The Haskell-API nature is desired to be
     87"non-blocking".
     88
     89'''Scheduling.'''
     90All current (and likely future) implementations of
     91concurrency in Haskell use non-preemptive scheduling.  That is, there are
     92explicit time points at which any one thread can ''yield'', allowing other threads to run.
     93The only differences between implementations are in the granularity and positioning of the yield.
     94
     95  * For Hugs, yield is inserted at certain I/O actions.
     96  * For ghc,  yield is inserted after some count of allocations.
     97  * For yhc,  yield is inserted after some count of bytecode instructions.
     98
     99Arguably, Hugs has made the wrong choice from a fairness point of view,
     100but moving the position of the yield, or inserting them more frequently,
     101should not be a big deal.
     102
     103----------
    69104= Levels =
    70105