[concurrency-interest] Single-threaded ForkJoinPool

cowwoc cowwoc at bbs.darktech.org
Sat Feb 6 08:06:51 EST 2016


Normally I would, but when it comes to race conditions empirical 
evidence doesn't really cut it :) I am looking for a guarantee (from the 
specification or the implementers) that the design is meant to cover 
this situation.

There is nothing worse than chasing down intermittent bugs :)

Gili

On 2016-02-06 7:37 AM, Viktor Klang [via JSR166 Concurrency] wrote:
> Try and report back :)
>
> On Sat, Feb 6, 2016 at 1:05 PM, cowwoc <[hidden email] 
> </user/SendEmail.jtp?type=node&node=13237&i=0>> wrote:
>
>     Interesting idea.
>
>     By the looks of it, returning null causes ForkJoinPool to give up
>     creating a new worker thread. If there are no active worker
>     threads, then ForkJoinTask.get() hangs forever. Now, I wonder if
>     it's safe to do as you mention... don't we run the risk of some
>     sort of race conditions where the first thread shuts down at the
>     exact same time that I reject the creation of the second thread
>     and as a result ForkJoinTask.get() hangs forever?
>
>     Gili
>
>     On 2016-02-06 4:39 AM, Viktor Klang [via JSR166 Concurrency] wrote:
>>
>>     What happens if you supply it with a thread factory which only
>>     allows a single thread to be alive at a time, and returns null if
>>     it already has returned a still living thread?
>>
>>     -- 
>>     Cheers,
>>>>
>>     On Feb 6, 2016 05:19, "cowwoc" <[hidden email]
>>     <http:///user/SendEmail.jtp?type=node&node=13234&i=0>> wrote:
>>
>>         Hi,
>>
>>         Is this the correct mailing list for discussing ForkJoinPool
>>         in JDK9? If
>>         not, please point me to the right place.
>>
>>         I have a feature request for ForkJoinPool which doesn't seem
>>         to be possible
>>         to implement without a JDK change:
>>         http://stackoverflow.com/q/34012134/14731
>>
>>         Specifically, I need to be able to an application that uses
>>         Random and
>>         ForkJoinPool in a deterministic manner when
>>         debugging/profiling but run
>>         full-speed in normal execution mode. I have all the moving
>>         parts nailing
>>         down except for ForkJoinPool.
>>
>>         If I create ForkJoinPool with a parallelism of 1, sometimes I
>>         see two worker
>>         threads getting used. I am guessing that this is caused by
>>         ForkJoinTask.get() invoking
>>         ForkJoinPool.common.externalHelpComplete(), but
>>         maybe something else is going on.
>>
>>         Is there a way for me to guarantee that ForkJoinThread will
>>         use exactly 1
>>         worker thread, no less, no more? Would you like me to file a
>>         formal feature
>>         request?
>>
>>         Thank you,
>>         Gili
>>
>>
>>
>>         --
>>         View this message in context:
>>         http://jsr166-concurrency.10961.n7.nabble.com/Single-threaded-ForkJoinPool-tp13232.html
>>         Sent from the JSR166 Concurrency mailing list archive at
>>         Nabble.com.
>>         _______________________________________________
>>         Concurrency-interest mailing list
>>         [hidden email]
>>         <http:///user/SendEmail.jtp?type=node&node=13234&i=1>
>>         http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>>
>>
>>     _______________________________________________
>>     Concurrency-interest mailing list
>>     [hidden email] <http:///user/SendEmail.jtp?type=node&node=13234&i=2>
>>     http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>>
>>
>>     ------------------------------------------------------------------------
>>     If you reply to this email, your message will be added to the
>>     discussion below:
>>     http://jsr166-concurrency.10961.n7.nabble.com/Single-threaded-ForkJoinPool-tp13232p13234.html
>>
>>     To unsubscribe from Single-threaded ForkJoinPool, click here.
>>     NAML
>>     <http://jsr166-concurrency.10961.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>     ------------------------------------------------------------------------
>     View this message in context: Re: Single-threaded ForkJoinPool
>     <http://jsr166-concurrency.10961.n7.nabble.com/Single-threaded-ForkJoinPool-tp13232p13236.html>
>
>
>     Sent from the JSR166 Concurrency mailing list archive
>     <http://jsr166-concurrency.10961.n7.nabble.com/> at Nabble.com.
>
>     _______________________________________________
>     Concurrency-interest mailing list
>     [hidden email] </user/SendEmail.jtp?type=node&node=13237&i=1>
>     http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>
>
> -- 
> Cheers,
>>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=13237&i=2>
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://jsr166-concurrency.10961.n7.nabble.com/Single-threaded-ForkJoinPool-tp13232p13237.html 
>
> To unsubscribe from Single-threaded ForkJoinPool, click here 
> <http://jsr166-concurrency.10961.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=13232&code=Y293d29jQGJicy5kYXJrdGVjaC5vcmd8MTMyMzJ8MTU3NDMyMTI0Nw==>.
> NAML 
> <http://jsr166-concurrency.10961.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://jsr166-concurrency.10961.n7.nabble.com/Single-threaded-ForkJoinPool-tp13232p13238.html
Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20160206/5d0e5c35/attachment-0001.html>


More information about the Concurrency-interest mailing list