[concurrency-interest] ForkJoinTask.externalAwaitDone() co-operates only with commonPool?

Ruslan Cheremin cheremin at gmail.com
Sun Feb 5 11:33:31 EST 2017


>Threads in all cases try to help, but in non-commonPool they may
reach a point where they block sooner than in common pool,
where they must continue to find and help with tasks vs
block in case there are no other workers, until/unless they
are sure that they are not needed.

May be I miss something important, but I can't see in code how do threads
tries to help:

FJTask.join() invokes FJTask.doJoin(), which, indeed, do tryUnpush(this)
and doExec(), but only if (currentThread instanceof FJPThread), otherwise
doJoin() invokes .externalAwaitDone(), which tries to help only commonPool.

I see no way non-FJP-thread invoking FJTask.join() may help some pool other
than commonPool...

Is it because there is no way to find out to which FJPool given FJTask was
submitted?


----
Ruslan

2017-02-05 18:53 GMT+03:00 Doug Lea <dl at cs.oswego.edu>:

> On 02/05/2017 10:34 AM, Ruslan Cheremin wrote:
>
>> Tracing the execution of FJTask.join() I've found the code
>> externalAwaitDone() (listed below), from which it is obvious external
>> (non-FJP) thread will try to help to execute tasks _only from
>> commonPool_, and just blocks otherwise.
>>
>
> Threads in all cases try to help, but in non-commonPool they may
> reach a point where they block sooner than in common pool,
> where they must continue to find and help with tasks vs
> block in case there are no other workers, until/unless they
> are sure that they are not needed.
>
> There are methods allowing manual control of this extra helping
> in non-commonpool usage. For example helpQuiesce and helpComplete.
> They are not performed otherwise because they can cause unnecessary
> overhead.
>
> -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/20170205/1479e4a7/attachment.html>


More information about the Concurrency-interest mailing list