[concurrency-interest] Fork/Join Use cases

Doug Lea dl at cs.oswego.edu
Sat Dec 13 09:26:20 EST 2014


On 12/12/2014 02:16 AM, Kirk Pepperdine wrote:

> Another question.. Spliterator on Streams.  I can see use cases which implies
> it’s a nice abstraction over Fork-Join. However, that you need a terminating
> condition to trigger the action certainly makes them far less useful than I
> initially hoped for.

By which you mean that a user/caller must choose a parallel granularity
threshold to control splitting? All implementable suggestions for
automating this would be welcome. The best we could do for j.u.Stream
usages of Spliterators is reduce it to a yes/no decision (stream() vs
parallelStream()).

> React seems far more useful but the API in RxJava seem
> unfortunately like something that only the elite could every possibly understand!
>

Similar issues arise whether you use push-style APIs (as in Rx
and CompletionStages) vs lazy/pull-style (as in j.u.Stream and
most divide-and-conquer FJ designs), which can make them harder
to understand.

In all cases, the current state of the art is that programmers
(possibly with the help of tools) must know something about
expected data sizes, rates, access patterns, etc to use them
effectively. This is not hugely different than choosing to
use LinkedList vs ArrayList, or HashMap vs TreeMap; but applied
to less familiar settings.

-Doug





More information about the Concurrency-interest mailing list