Concurrent Haskell 4249256 144822208 2007-07-15T17:15:47Z Cae prince 4074067 /* Software Transactional Memory */ '''Concurrent Haskell''' extends<ref>Simon Peyton Jones, Andrew Gordon, and Sigbjorn Finne. [http://www.haskell.org/ghc/docs/papers/concurrent-haskell.ps.gz Concurrent Haskell]. ''ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (PoPL).'' 1996. (Some sections are out of date with respect to the current implementation.)</ref> [[Haskell 98]] with explicit concurrency. The two main concepts underpinning Concurrent Haskell are: * A primitive type <code>MVar α</code> implementing a bounded/single-place [[Actor model and process calculi#Asynchronous channels|asynchronous channel]], which is either empty or holds a value of type <code>α</code>. * The ability to spawn a concurrent thread via the <code>forkIO</code> primitive. Built atop this is a collection of useful concurrency and synchronisation abstractions<ref>The [http://www.haskell.org/ghc/docs/latest/html/libraries/ Haskell Hierarchical Libraries], [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html Control.Concurrent]</ref> such as [[Actor model and process calculi#Asynchronous channels|unbounded channels]], [[Semaphore (programming)|semaphores]] and sample variables. Default Haskell threads have very low overheads: creation, context-switching and scheduling are all internal to the Haskell runtime. Fully-fledged operating system processes are nevertheless available through the <code>forkOS</code> primitive on supported architecture and operating system combinations. == Software Transactional Memory == The recently introduced [[Software Transactional Memory]] (STM)<ref>Tim Harris, Simon Marlow, Simon Peyton Jones, and [[Maurice Herlihy]]. [http://research.microsoft.com/Users/simonpj/papers/stm/stm.pdf Composable Memory Transactions]. ''ACM Conference on Principles and Practice of Parallel Programming 2005'' (PPoPP'05). 2005.</ref> extension<ref>[http://www.haskell.org/ghc/docs/latest/html/libraries/stm/Control-Concurrent-STM.html Control.Concurrent.STM]</ref> to the [[Glasgow Haskell Compiler]] reuses the process forking primitives of Concurrent Haskell. STM however: * eschews <code>MVar</code>s in favour of <code>TVar</code>s. * introduces the <code>retry</code> and <code>orElse</code> primitives, allowing alternative [[atomic actions]] to be ''composed'' together. == References: == <references/> [[Category:Haskell programming language family]] {{compu-lang-stub}}