Changes between Version 96 and Version 97 of LightweightConcurrency


Ignore:
Timestamp:
May 23, 2012 12:54:02 AM (2 years ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v96 v97  
    6767writePVar  :: PVar a -> a -> PTM () 
    6868atomically :: PTM a -> IO a 
    69 }}} 
    70  
    71 A PTM transaction may allocate, read and write transactional variables of type `PVar a`. It is important to notice that PTM does not provide a blocking `retry` mechanism. Such a blocking action needs to interact with the scheduler, to block the current thread and resume another thread. We will see [#AbstractSchedulerInterface later] how to allow such interactions while not imposing any restriction on the structure of the schedulers. 
     69retry      :: PTM a 
     70}}} 
     71 
     72A PTM transaction may allocate, read and write transactional variables of type `PVar a`. It is important to notice that PTM does provide a blocking `retry` mechanism which needs to interact with the scheduler, to block the current thread and resume another thread. We will see [#PTMretry later] how we allow such interactions while not imposing any restriction on the structure of the schedulers. 
    7273 
    7374=== One-shot Continuations === 
     
    387388=== PTM retry === 
    388389 
    389 GHC's STM module provides a  
     390GHC's STM module provides a `retry` primitive, which blocks the thread invoking retry to block until one of the TVars it has read has been written to. After a thread blocks on the STM, the next available thread from the capability's run queue is resumed. Eventually, the blocked thread is added back to the run queue when one of the TVars in its read set has been written to.  
     391 
     392In the LWC implementation, while waiting on a PVar is still an RTS mechanism, interaction with the scheduler is implemented using the scheduler actions. After blocking the thread on the PTM, RTS executes the thread's yieldControlAction to resume the scheduler. When the thread is eventually unblocked, its scheduleSContAction is executed to put the thread back into its user-level scheduler data structure. 
    390393 
    391394=== Black-hole Handling ===