[concurrency-interest] Efficient wait during the exection of a fork join task

Antoine CHAMBILLE ach at quartetfs.com
Fri Oct 8 04:08:59 EDT 2010

According to its documentation, the fork join pool targets workloads where
each task works independently on a data section that is isolated from
concurrent tasks. The only kind of acceptable "waiting" is to join
sub-tasks. One of the great features of the fork join pool is that when a
task waits for the completion of a child task, it releases the worker thread
and allows some other tasks to complete, instead of wasting the current


But I think the fork join pool is too great to be restricted to that kind of
workload. I am sure a lot of developers use it already more generally with
tasks that contribute to shared structures and do a bit of locking. But then
when the task waits to acquire a lock, the worker thread is wasted, although
it could theoretically execute another pending task like during a join.



Would it be possible to efficiently use the worker thread also in that case?

-          Maybe with some ForkJoinTask.activeWait() method one could call
after failing acquiring a lock.

-          Or something like ForkJoinTask.acquire(Lock lock).

-          Or with a special lock implementation ( Lock
ForkJoinPool.createLock() ) that would consume pending tasks until acquired.





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

More information about the Concurrency-interest mailing list