December 2022
Intermediate to advanced
528 pages
15h 41m
English
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.
You can implement a reference sequential runner as follows:
Scala ...
Read now
Unlock full access