[concurrency-interest] Fork/Join Use cases

Richard Warburton richard.warburton at gmail.com
Mon Dec 15 11:08:35 EST 2014


Hi Aleksandar,

Thanks for your reply.

I always found fork/join to be a very foundational, and serving as a solid
> thread pool implementation that works really well, and doesn't blow up,
> which the JDK otherwise lacked. In many cases it serves as a building block
> for other frameworks, since one of the advantages is that all the other
> abstractions can optionally share the same computational resources. But
> since you said that you're not interested in futures, parallel collections,
> Rx, actors...
>

Yes - there is the argument that it can be a useful underlying abstraction
for other frameworks. I'm not trying to be too negative about fork/join as
a framework - I just want to understand what problems people have found it
solve in the application developer space.

For concrete code, one of the applications that comes to mind is parallel
> sorting. You might want to search for Doug Lea's parallel array
> implementation to see it.
> Otherwise, I'm sure you could easily use fj to implement minimax
> algorithms for chess AI, a constraint solving problem, typechecking in a
> compiler, or concurrently issuing a request to several web services.
>

I like Minimax and constraint solving - those are good examples, albeit not
the kind of problem that many Java developers do.

I'm not that convinced that type checking is often a task that is directly
parallelised, compiler internals that I've looked at often rely on more
coarse grained batch parallelism. Also, surely this isn't something that's
done often enough to be a motivating use case for a general framework?

In the case of concurrently issuing requests to several web services my
understanding is that would be a bad use case for Fork/Join. This is
because the work stealing approach is really tuned for CPU bound workloads,
not I/O bound workloads.

To find more use cases, it might make sense to search for online examples
> of Cilk code, as it was one of the first to employ the fork/join model.
>

Thanks - I'll look into that.

regards,

  Richard Warburton

  http://insightfullogic.com
  @RichardWarburto <http://twitter.com/richardwarburto>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20141215/e44a454e/attachment.html>


More information about the Concurrency-interest mailing list