Changes between Version 64 and Version 65 of LightweightConcurrency


Ignore:
Timestamp:
May 20, 2012 11:20:27 PM (3 years ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v64 v65  
    260260== Parallelism and System Threads ==
    261261
    262 Whatever be the concurrency model, we would like to retain the non-programmatic control over parallelism (using +RTS -N). Just like in the current system, this runtime parameter controls the maximum number of capabilities. Cores are system resources and hence, the control over their allocation to different processes should be a property of the context under which the programs are run. The concurrency substrate exposes the primitive
    263 
    264 {{{
     262Whatever be the concurrency model, we would like to retain the non-programmatic control over parallelism (using +RTS -N). Just like in the current system, this runtime parameter controls the maximum number of capabilities. Cores are system resources and hence, the control over their allocation to different processes should be a property of the context under which the programs are run. The concurrency substrate exposes the following primitives
     263
     264{{{
     265getNumCapabilities   :: IO Int
     266getCurrentCapability :: PTM Int
     267
    265268newCapability :: SCont -> IO ()
    266269}}}
    267270
    268 which runs the given SCont on a free capability. If there are no free capabilities, a runtime error is raised. A typical, initial task spawned on another core would pull work from the scheduler and switch to it. For example,
     271Primitive `newCapability` runs the given SCont on a free capability. If there are no free capabilities, a runtime error is raised. A typical, initial task spawned on another core would pull work from the scheduler and switch to it. For example,
    269272
    270273{{{
     
    277280}}}
    278281
     282When a program boots up with `N` capabilities, it can choose to create `N-1` additional capabilities using the primitive `newCapability` which run `initialTask`.
     283
    279284=== Task Model ===
    280285
     
    286291
    287292{{{
    288 getNumCapabilities ::
    289 setSContCapability :: SCont -> Int -> IO ()
    290 getSContCapability :: SCont -> PTM Int
     293setSContCapability   :: SCont -> Int -> IO ()
     294getSContCapability   :: SCont -> PTM Int
    291295}}}
    292296