Unfortunately Java doesn't come with any parallel sorting algorithm (e. g. in Arrays or Collections).
Luckily enough Java 7 comes with a feature called ForkJoin, so we can easily write one ourselves.
It is an ExecutorService designed specifically for splitting work in divide and conquer algorithms.
So it can be used not only to sort but for other algorithms, that divide work in parts and wait for completion, as well, such as binary tree construction or stuff like that.
General usage looks as following:
Read full article from ForkJoin for parallel sorting (and more) | High performance in java
No comments:
Post a Comment