1 |
/* |
2 |
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
* Expert Group and released to the public domain, as explained at |
4 |
* http://creativecommons.org/licenses/publicdomain |
5 |
*/ |
6 |
|
7 |
|
8 |
/** |
9 |
* A fine-grained parallel computation framework. ForkJoinTasks and |
10 |
* their related support classes provide a very efficient basis for |
11 |
* obtaining platform-independent parallel speed-ups of |
12 |
* computation-intensive operations. They are not a full substitute |
13 |
* for the kinds of arbitrary processing supported by Executors or |
14 |
* Threads. However, when applicable, they typically provide |
15 |
* significantly greater performance on multiprocessor platforms. |
16 |
* |
17 |
* <p> Candidates for fork/join processing mainly include those that |
18 |
* can be expressed using parallel divide-and-conquer techniques: To |
19 |
* solve a problem, break it in two (or more) parts, and then solve |
20 |
* those parts in parallel, continuing on in this way until the |
21 |
* problem is too small to be broken up, so is solved directly. The |
22 |
* underlying <em>work-stealing</em> framework makes subtasks |
23 |
* available to other threads (normally one per CPU), that help |
24 |
* complete the tasks. In general, the most efficient ForkJoinTasks |
25 |
* are those that directly implement this algorithmic design pattern. |
26 |
* |
27 |
* <p>While direct implementation of parallel divide-and-conquer |
28 |
* algorithms is often straightforward, it can also be tedious and |
29 |
* code-intensive. For this reason, a number of solution "templates" |
30 |
* are available for common kinds of operations on lists and arrays: |
31 |
* applying some operation to all elements, combining elements |
32 |
* according to some function, and so on. In this preliminary |
33 |
* release, these are presented via some interfaces describing the |
34 |
* associated code bodies in TaskTypes, along with an evolving set of |
35 |
* implementations for lists and arrays of objects and scalars. |
36 |
*/ |
37 |
package jsr166y.forkjoin; |