What is the Fork/Join framework (JSR 166y)?

A new feature in Java 7, the fork/join framework allows developers to take advantage of multiple processors by distributing tasks to worker threads in a thread pool. Unlike other Executor Services, fork/join uses a unique work-stealing algorithm that allows worker threads that aren't busy to do the tasks assigned to threads that currently are busy.

The basic framework for fork/join code is as follows:

if (my portion of the work is small enough)
  do the work directly
  split my work into two pieces
  invoke the two pieces and wait for the results

You'll need to wrap this code as a ForkJoinTask subclass, usually as a RecursiveTask or a RecursiveAction.

Source link

The Java Tutorials Fork/Join

Further Reading

DevX article on fork/join framework