[OT] ParallelArray was RE: stack-bound vs. travelling closures proposal.

Doug Lea dl at cs.oswego.edu
Fri Jun 25 22:08:44 PDT 2010


> It's also worth mentioning in passing, those folks doing blocking I/O,
> or coarse grained parallelism of tasks of nonuniform size, in
> ParallelArray are probably going to eventually notice the behavior of
> the below--although it may or may not cause severe real world problems,
> the call to r.atLeaf() can occasionally result in some surprising
> serialization of the very last few items in a workload. Not a big deal,
> I guess, since the biggest split is always going to be stolen first, and
> then further split by the thief (right?)

Yes, although stay tuned for some small improvements that
tend to reduce flurries of not-very-helpful steals as
computations wind down.

-Doug


>
>         final void internalCompute(int l, int h, int g) {
>             FJBase r = null;
>             do {
>                 int rh = h;
>                 h = (l + h) >>> 1;
>                 (r = newSubtask(h, rh, r)).fork();
>             } while (h - l > g);
>             atLeaf(l, h);
>             do {
>                 if (r.tryUnfork()) r.atLeaf(r.lo, r.hi); else r.join();
> 					     ^^^^^^^^^^^^^^^^^^^^^
>                 onReduce(r);
>                 r = r.next;
>             } while (r != null);
>         }
>




More information about the lambda-dev mailing list