As I understand jdk7 has the support for fork-and-join, Can I use fork-and-join in JDK6 without upgraging to JDK7.0?
The fork() method submits a task to a pool, but it doesn't trigger its execution. We must use the join() method for this purpose. Here we used the invokeAll() method to submit a sequence of subtasks to the pool. We can do the same job with fork() and join(), though this has consequences for the ordering of the results.
Fork–join is the main model of parallel execution in the OpenMP framework, although OpenMP implementations may or may not support nesting of parallel sections. It is also supported by the Java concurrency framework, the Task Parallel Library for . NET, and Intel's Threading Building Blocks (TBB).
In short, the main difference between the Executor framework and ForkJoinPool is that the former provides a general-purpose thread pool, while the latter provides a special implementation that uses a work-stealing pattern for efficient processing of ForkJoinTask.
Yup, see here - the package you want is jsr166y.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With