Chapter 24
Case Study: Parallel Execution
This chapter investigates, as a case study, the problem of performing a collection of independent tasks in parallel. Tasks are represented as executions of an impure function, run for its side effects. (Value-returning tasks are the focus of the next few chapters.) Different strategies are explored that rely on explicit thread creation (bounded or unbounded), thread pools (bounded or unbounded, dedicated or shared), or parallel collections. The last section uses conditions and semaphores to implement a variant in which additional tasks can be submitted after the computation has already started.
24.1 Sequential Reference Implementation
You can implement a reference sequential runner as follows:
Scala ...
Get Functional and Concurrent Programming: Core Concepts and Features now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.