[concurrency-interest] ForkJoinPool.managedBlock() not spawning new thread

Alex Lam S.L. alexlamsl at gmail.com
Fri Jul 20 14:49:10 EDT 2012


On Fri, Jul 20, 2012 at 11:23 AM, Doug Lea <dl at cs.oswego.edu> wrote:
> Yes. We cannot do anything like this in general, because
> the steals here might violate task dependencies -- joining
> the stolen task could block waiting for the current action
> to finish, which it never will. But so long
> as you know that this is not possible, it can work well.

Update: after some wall clock measurements, the naive version (which
only uses ~88% CPU) is not statistically slower (i.e. sometimes
faster) than the Task.steal() version.

So though I feel a bit surprised by it, I think I will live with the
simpler code and have some spare CPU cycles for typing emails :-)


Alex.


More information about the Concurrency-interest mailing list