Changes between Version 69 and Version 70 of LightweightConcurrency


Ignore:
Timestamp:
May 21, 2012 4:46:17 PM (3 years ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v69 v70  
    155155}}} 
    156156 
    157 The implementation is pretty straight-forward; scheduleSContAction appends the given scont to the back of the list, and yieldControlAction picks an SCont from the front of the list and switches to it. Having the scheduler actions as PTM actions ensures that the operations on the scheduler are always properly synchronized. Notice that scheduleSContAction returns while yieldControlAction does not. We expect every user-level thread (SCont) to be associated with a scheduler. Typically, when a new SCont is created, it is immediately associated with a scheduler. 
     157The implementation is pretty straight-forward; scheduleSContAction appends the given scont to the back of the list, and yieldControlAction picks an SCont from the front of the list and switches to it. The `otherwise` case of yieldControlAction is chosen if the there are no available SConts to switch to. This will be discussed later under [#SleepCapability Sleep Capability]. 
     158 
     159Having the scheduler actions as PTM actions ensures that the operations on the scheduler are always properly synchronized. Notice that scheduleSContAction returns while yieldControlAction does not. We expect every user-level thread (SCont) to be associated with a scheduler. Typically, when a new SCont is created, it is immediately associated with a scheduler. 
    158160 
    159161== User-level Concurrency == 
     
    285287=== Sleep Capability === 
    286288 
     289In a multicore setting, runnable SConts might not always be available on a capability. In this case, the capability must wait for SConts to be added to the scheduler. In our system, this must be handled under `yieldControlAction`, where it is expected that the control switches to another SCont. The concurrency substrate provides  
     290 
     291{{{ 
     292sleepCapability :: PTM () 
     293}}} 
     294 
     295primitive that blocks the current capability until one of the PVars that it has read from has been updated. Thus, the complete implementation of yieldControlAction example introduced [#AbstractingtheScheduler earlier] is given below. 
     296 
     297 
    287298 
    288299=== SCont Affinity ===