Changes between Version 16 and Version 17 of Concurrency


Ignore:
Timestamp:
Mar 30, 2006 9:56:50 AM (8 years ago)
Author:
simonmar@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Concurrency

    v16 v17  
    9898 
    9999'''Scheduling.''' 
    100 All current (and likely future) implementations of 
     100Most current implementations of 
    101101concurrency in Haskell use non-preemptive scheduling.  That is, there are 
    102102explicit time points at which any one thread can ''yield'', allowing other threads to run. 
     
    104104 
    105105  * For Hugs, yield is inserted at certain I/O actions. 
    106   * For ghc,  yield is inserted after some count of allocations. 
     106  * For ghc in non-SMP mode,  yield is inserted after some count of allocations. 
    107107  * For yhc,  yield is inserted after some count of bytecode instructions. 
    108108 
    109109Arguably, Hugs has made the wrong choice from a fairness point of view.  It would be possible to make Hugs yield more often, such as in IO-monad's bind operator, but even this wouldn't be quite enough for fairness, because a thread might hang indefinitely performing a non-IO computation.  Yielding outside of the IO monad in Hugs doesn't seem possible without overhauling the concurrency implementation completely. 
     110 
     111The notable exception to the above is GHC in SMP mode, which can run multiple Haskell threads simultaneously in separate OS threads, and hence simultaneously on multiple CPUs if available.  This implementation is truly preemptive. 
    110112 
    111113----------