Chapter 7. Concurrency and Performance

Writing concurrent programs that are correct is hard: subtle race conditions, resources blocked by another thread, asynchronous exceptions, and so on. Basically, a lot can go wrong. Remember that, whereas parallelism points to execution model (multiple threads running simultaneously), concurrency is more like a paradigm: multiple threads working together, intertwined. However, concurrent threads are often run in parallel for responsiveness and performance reasons.

In this chapter, we will write concurrent Haskell programs making use of light-weight threads and type-safe concurrency primitives like MVars. For complex programs, we will learn to build atomic transactions with Software Transactional Memory (

Get Haskell High Performance Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.