Package jsr166z.forkjoin

A fine-grained parallel computation framework.

See:
          Description

Interface Summary
ForkJoinExecutor An object that executes ForkJoinTask computations.
ForkJoinPool.ForkJoinWorkerThreadFactory Factory for creating new ForkJoinWorkerThreads.
 

Class Summary
AsyncAction Resultless ForkJoinTasks with explicit completions.
CyclicAction A computation that is broken into a series of task executions, each separated by a TaskBarrier arrival.
ForkJoinPool Host for a group of ForkJoinWorkerThreads that perform ForkJoinTasks.
ForkJoinPool.DefaultForkJoinWorkerThreadFactory The default ForkJoinWorkerThreadFactory, used unless overridden in ForkJoinPool constructors.
ForkJoinTask<V> Abstract base class for tasks that run within a ForkJoinPool.
ForkJoinWorkerThread A thread that is internally managed by a ForkJoinPool to execute ForkJoinTasks.
LinkedAsyncAction Resultless ForkJoinTasks with explicit completions, that may be linked in parent-child relationships.
Ops Interfaces and utilities describing per-element operations used within parallel methods on aggregates.
Ops.CompoundMapper<T,U,V> A composite mapper that applies a second mapper to the results of applying the first one
Ops.DoubleMaxReducer A reducer returning the maximum of two double elements, using the given comparator
Ops.DoubleMinReducer A reducer returning the minimum of two double elements, using the given comparator
Ops.IntMaxReducer A reducer returning the maximum of two int elements, using the given comparator
Ops.IntMinReducer A reducer returning the minimum of two int elements, using the given comparator
Ops.LongMaxReducer A reducer returning the maximum of two long elements, using the given comparator
Ops.LongMinReducer A reducer returning the minimum of two long elements, using the given comparator
Ops.MaxReducer<T> A reducer returning the maximum of two elements, using the given comparator, and treating null as less than any non-null element.
Ops.MinReducer<T> A reducer returning the minimum of two elements, using the given comparator, and treating null as greater than any non-null element.
Ops.NaturalMaxReducer<T extends Comparable<? super T>> A reducer returning the maximum of two Comparable elements, treating null as less than any non-null element.
Ops.NaturalMinReducer<T extends Comparable<? super T>> A reducer returning the minimum of two Comparable elements, treating null as less than any non-null element.
ParallelArray<T> An array supporting parallel operations.
ParallelArray.WithBounds<T> A restriction of parallel array operations to apply only within a given range of indices.
ParallelArray.WithDoubleMapping<T> A modifier for parallel array operations to apply to mappings of elements to doubles, not to the elements themselves
ParallelArray.WithFilter<T> A restriction of parallel array operations to apply only to elements for which a selector returns true
ParallelArray.WithIntMapping<T> A modifier for parallel array operations to apply to mappings of elements to ints, not to the elements themselves
ParallelArray.WithLongMapping<T> A modifier for parallel array operations to apply to mappings of elements to longs, not to the elements themselves
ParallelArray.WithMapping<T,U> A modifier for parallel array operations to apply to mappings of elements, not to the elements themselves
ParallelDoubleArray An array of doubles supporting parallel operations.
ParallelDoubleArray.WithBounds A restriction of parallel array operations to apply only within a given range of indices.
ParallelDoubleArray.WithDoubleMapping A modifier for parallel array operations to apply to mappings of elements to doubles, not to the elements themselves
ParallelDoubleArray.WithFilter A restriction of parallel array operations to apply only to elements for which a selector returns true
ParallelDoubleArray.WithIntMapping A modifier for parallel array operations to apply to mappings of elements to ints, not to the elements themselves
ParallelDoubleArray.WithLongMapping A modifier for parallel array operations to apply to mappings of elements to longs, not to the elements themselves
ParallelDoubleArray.WithMapping<U> A modifier for parallel array operations to apply to mappings of elements, not to the elements themselves
ParallelIntArray An array of ints supporting parallel operations.
ParallelIntArray.WithBounds A restriction of parallel array operations to apply only within a given range of indices.
ParallelIntArray.WithDoubleMapping A modifier for parallel array operations to apply to mappings of elements to doubles, not to the elements themselves
ParallelIntArray.WithFilter A restriction of parallel array operations to apply only to elements for which a selector returns true
ParallelIntArray.WithIntMapping A modifier for parallel array operations to apply to mappings of elements to ints, not to the elements themselves
ParallelIntArray.WithLongMapping A modifier for parallel array operations to apply to mappings of elements to longs, not to the elements themselves
ParallelIntArray.WithMapping<U> A modifier for parallel array operations to apply to mappings of elements, not to the elements themselves
ParallelLongArray An array of longs supporting parallel operations.
ParallelLongArray.WithBounds A restriction of parallel array operations to apply only within a given range of indices.
ParallelLongArray.WithDoubleMapping A modifier for parallel array operations to apply to mappings of elements to doubles, not to the elements themselves
ParallelLongArray.WithFilter A restriction of parallel array operations to apply only to elements for which a selector returns true
ParallelLongArray.WithIntMapping A modifier for parallel array operations to apply to mappings of elements to ints, not to the elements themselves
ParallelLongArray.WithLongMapping A modifier for parallel array operations to apply to mappings of elements to longs, not to the elements themselves
ParallelLongArray.WithMapping<U> A modifier for parallel array operations to apply to mappings of elements, not to the elements themselves
RecursiveAction Recursive resultless ForkJoinTasks.
RecursiveTask<V> Recursive result-bearing ForkJoinTasks.
TaskBarrier A synchronization barrier for ForkJoinTasks.
 

Package jsr166z.forkjoin Description

A fine-grained parallel computation framework. ForkJoinTasks and their related support classes provide a very efficient basis for obtaining platform-independent parallel speed-ups of computation-intensive operations. They are not a full substitute for the kinds of arbitrary processing supported by Executors or Threads. However, when applicable, they typically provide significantly greater performance on multiprocessor platforms.

Candidates for fork/join processing mainly include those that can be expressed using parallel divide-and-conquer techniques: To solve a problem, break it in two (or more) parts, and then solve those parts in parallel, continuing on in this way until the problem is too small to be broken up, so is solved directly. The underlying work-stealing framework makes subtasks available to other threads (normally one per CPU), that help complete the tasks. In general, the most efficient ForkJoinTasks are those that directly implement this algorithmic design pattern.

While direct implementation of parallel divide-and-conquer algorithms is often straightforward, it can also be tedious and code-intensive. For this reason, a number of solution "templates" are available for common kinds of operations on lists and arrays: applying some operation to all elements, combining elements according to some function, and so on. In this preliminary release, these are presented via some interfaces describing the associated code bodies in TaskTypes, along with an evolving set of implementations for lists and arrays of objects and scalars.