9781449335946
index.html

Parallel and Concurrent Programming in Haskell

Simon Marlow


Preface
Audience
How to read this book
Conventions used in this book
Acknowledgements
1. Introduction
Terminology: Parallelism and Concurrency
Tools and resources
Sample Code
I. Parallel Haskell
2. Basic parallelism: the Eval monad
Lazy evaluation and Weak-Head Normal Form
The Eval monad, rpar, and rseq
Example: Parallelizing a Sudoku Solver
Deepseq
3. Evaluation Strategies
A Strategy for evaluating a list in parallel
Example: the K-Means problem
Parallelizing K-Means
Performance and analysis
Visualising spark activity
Granularity
GC’d Sparks and Speculative parallelism
Parallelizing lazy streams with parBuffer
More Strategies
II. Concurrent Haskell
4. Basic concurrency: threads and MVars
A simple example: reminders
Communication: MVars
MVar as a simple channel: a logging service
MVar as a container for shared state
MVar as a building block: unbounded channels
Fairness
5. Overlapping input/output
Exceptions in Haskell
Error handling with Async
Merging
6. Cancellation and timeouts
Asynchronous Exceptions
Masking Asynchronous Exceptions
Asynchronous Exception Safety
Timeouts
Catching Asynchronous Exceptions
mask and forkIO
Asynchronous Exceptions: Discussion
7. Software Transactional Memory
Running example: managing windows
Blocking
Blocking until something changes
Merging with STM
Async revisited
Implementing channels with STM
An alternative channel implementation
Bounded Channels
What can we not do with STM?
Performance
Summary
8. Higher-level concurrency abstractions
Avoiding thread leakage
Symmetric concurrency combinators
Timeouts using race
Adding a Functor instance
9. High-speed concurrent server applications
A trivial server
Extending the simple server with state
A chat server
10. Parallel programming using threads
How to achieve parallelism with concurrency
A simple filesystem-searching program
Sequential version
Parallel version
Performance and scaling
Reducing the overhead of parallelism
Thread Pools
The ParIO monad
Index
Site last updated on: February 24, 2013 at 08:43:03 AM PST
Cover for Parallel and Concurrent Programming in Haskell