The fork/join is multi-core-friendly, lightweight parallel framework, that uses the strategy of recursively splitting a task into smaller sub-tasks; forking the sub-tasks into separate processes or threads, so that they run in parallel on multiple cores; and joining all sub-tasks to compose a result to return. The fork/join framework is expected to be added to Java 7.
The code listing shown here demonstrates a simple parallel algorithm to compute the Fibonacci numbers. On a two-core machine, it achieves a nearly twofold speedup over an equivalent sequential algorithm (click to see a clearer image):
Note that the program strives to describe the algorithm based on the fork/join primitives; the details of threading and scheduling are hidden by the framework. Notice also that the program moves to sequential computation for problems below a certain size. This kind of tuning is usually required to produce optimal efficiency from distributed algorithms.