[concurrency-interest] Merging forked tasks - Repeating because of some formatting problem

Ramsundar Kandasamy kramasundar at yahoo.com
Wed Mar 17 04:09:38 EDT 2010


Thanks Doug.

I will try your suggestion to use Merger from your ScalarLongSort example.

Thanks,

Ramsundar Kandasamy

kramasundar.blogspot.com     GoogleTamil      ProjectMadurai          

--- On Tue, 3/16/10, Doug Lea <dl at cs.oswego.edu> wrote:

From: Doug Lea <dl at cs.oswego.edu>
Subject: Re: [concurrency-interest] Merging forked tasks - Repeating because of some formatting problem
To: concurrency-interest at cs.oswego.edu
Date: Tuesday, March 16, 2010, 5:17 PM

On 03/16/10 06:55, Ramsundar Kandasamy wrote:
>
> I am playing around with this ForkJoin framework. I was trying the first
> sample usage of RecursiveAction given in its javaDoc page.
>
> class SortTask extends RecursiveAction {
> ....
> protected void compute() {
> if (hi - lo < THRESHOLD)
> sequentiallySort(array, lo, hi);
> else {
> int mid = (lo + hi) >>> 1;
> invokeAll(new SortTask(array, lo, mid), new SortTask(array, mid, hi));
> merge(array, lo, hi); //!!!!! how to do this
> }
> }
> }
>
> and following is my sequentiallySort method
>
> private void sequentiallySort(Integer[] array, int lo, int hi) {
> Arrays.sort(array, lo, hi + 1);
> }
>
> but I don't know how should I design the merge(array, lo, hi) method?
>

While any kind of array merge will suffice,
one way to do this that enables more parallelism
(adapted from "cilksort") is included in one of
our test programs, ScalaraLongSort that you now find in CVS:
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/test/loops/ScalarLongSort.java?view=log

-Doug

_______________________________________________
Concurrency-interest mailing list
Concurrency-interest at cs.oswego.edu
http://cs.oswego.edu/mailman/listinfo/concurrency-interest



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20100317/a41083db/attachment.html>


More information about the Concurrency-interest mailing list