Changes between Version 65 and Version 66 of LightweightConcurrency


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

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v65 v66  
    258258As an aside, the race condition in [http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Concurrent-MVar.html#v%3AswapMVar swapMVar] can be eliminated with the help of PTM abstraction. TODO: show example. Thus, PTM abstraction makes it easy to construct correct concurrent data-structures.
    259259
    260 == Parallelism and System Threads ==
    261 
    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 following primitives
     260== System Threads and Parallelism ==
     261
     262We retain the task model of the current runtime system. There is a one-to-one mapping between tasks and system threads. Tasks are not exposed to the programmer and is transparently managed by the RTS. Any task that is not performing a safe-foreign call needs to acquire a `capability` to run. The number of capabilities represents the number of SConts that can run in parallel. Just like in the current system, the rts parameter `-N` 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. Hence, we believe it is important to have non-programmatic control over parallelism.
     263
     264A program always boots up on 1 core running the `main` function. Additional capabilities can be created on demand using the following primitives.
    263265
    264266{{{
    265267getNumCapabilities   :: IO Int
    266268getCurrentCapability :: PTM Int
    267 
    268269newCapability :: SCont -> IO ()
    269270}}}
     
    282283When a program boots up with `N` capabilities, it can choose to create `N-1` additional capabilities using the primitive `newCapability` which run `initialTask`.
    283284
    284 === Task Model ===
    285 
    286 We retain the task model of the current runtime system. There is a one-to-one mapping between tasks and system threads. Tasks are not exposed to the programmer and is transparently managed by the RTS.
    287285
    288286=== SCont Affinity ===