ABSTRACT

In the last chapter, we introduced the key concepts of multithreading and showed the primary libraries that you should use when you are multithreading in Scala. The use of Futures, parallel collections, and Akka actors provides a safe way to do the vast majority of parallel tasks. So why do we have another chapter on parallel programming? There are two main reasons for having this chapter, which focuses on the threading features of the Java languages. First, some of these libraries are the lower-level underpinnings of all the Scala libraries, and they represent the type of parallelism that will be available in a broader variety of languages.1 The second reason is that the parallel collections in Java are recommended for use in Scala as well, and there are use cases where they are an easier way of doing things when using Futures and parallel collections.