Is Concurrent Haskell still limited to a single OS thread?

In a 2005 research paper, he said

Concurrent Haskell is currently implemented only for the uni-processor. The time schedule runs a Haskell thread with a small thread in the same thread of the operating system. Haskell threads only pause at well-defined "safe points"; they cannot be warned at arbitrary points.

Is this changed or is Concurrent Haskell still limited to one OS thread?

+6
multithreading concurrency haskell multicore
source share
3 answers

GHC can use multi-core processors for Concurrent and Parallel Haskell since 2004 . Parallel, parallel, nested data Parallel Haskell uses the same multi-threaded runtime.

+6
source share

[edit: the question only mentions Concurrent Haskell, but the link to the document, it seems to me, is "Composable Memory Transactions", the document in which Haskell STM was first described. Please correct me if I am wrong.]

STM now works fine on multiple cores. A parallel implementation was first shipped to GHC 6.6 and uses a fine-grained two-phase blocking strategy; that is, to commit a transaction, the implementation first tries to lock every variable involved in the transaction, then makes the changes and finally opens all the variables. The acquisition of a lock is not blocked: if the lock is already held, the transaction is aborted and retries (this avoids the usual lock-cancel order blocking, which will be applied if the lock lock is locked).

This STM implementation, of course, is not the fastest - many alternative methods are described in the literature that will lead to better performance, but the GHC implementation is relatively simple and does not include any global locks (transactions working with different sets of variables can be executed in parallel without interference )

+18
source share

GHC Haskell works well on multi-codes

Since 2004, GHC Haskell programs run several Haskell threads over multiple OS threads that are distributed across multiple cores.

Alternatively, you can get the latest multi-core Haskell status from this SO question.

+5
source share

All Articles