Chapter 6. Optimizing Divide and Conquer Solutions – The Fork/Join Framework
In Chapter 2, Managing Lots of Threads – Executors, Chapter 3, Getting the Maximum from Executors, and Chapter 4, Getting Data from the Tasks – The Callable and Future Interfaces, you learned how to work with executors as a mechanism to improve the performance of concurrent applications that executes lots of concurrent tasks. The Java 7 concurrency API introduces a special kind of executor through the Fork/Join framework. This framework is designed to implement optimal concurrent solutions to those problems that can be solved using the divide and conquer design paradigm. In this chapter, we will cover the following topics:
- An introduction to the Fork/Join framework
- The first example – the k-means clustering algorithm
- The second example – a data filtering algorithm
- The third example – the merge sort algorithm