| Start | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| The Eval Monad Parallelism in Haskell can be expressed using the Running Note: ensure you compile with |
||||||||||||
| rpar
Running this will demonstrate the concurrent behaviour: |
||||||||||||
| rseq We can use This subtly changes the semantics of the Parameters
RemarksSimon Marlow's book (opens new window), Concurrent and Parallel Programming in Haskell, is outstanding and covers a multitude of concepts. It is also very much accessible for even the newest Haskell programmer. It is highly recommended and available in PDF or online for free. Parallel vs Concurrent Simon Marlow puts it best (opens new window): A parallel program is one that uses a multiplicity of computational hardware (e.g., several processor cores) to perform a computation more quickly. The aim is to arrive at the answer earlier, by delegating different parts of the computation to different processors that execute at the same time. By contrast, concurrency is a program-structuring technique in which there are multiple threads of control. Conceptually, the threads of control execute “at the same time”; that is, the user sees their effects interleaved. Whether they actually execute at the same time or not is an implementation detail; a concurrent program can execute on a single processor through interleaved execution or on multiple physical processors. Weak Head Normal Form It's important to be aware of how lazy-evaluation works. The first section of this chapter (opens new window) will give a strong introduction into WHNF and how this relates to parallel and concurrent programming. |
Read Article
https://develop.horje.com/learn/1434/reference