[concurrency-interest] Recursion -> FJTasks question

Ken Horn ken.horn@db.com
Wed, 9 Apr 2003 09:42:17 +0100


Appologies for not getting back to you before. The ONLY locking code in my implementation (unless the XML lib, dom4j is blocking, which the stack trace doesn't imply) is the synchronized method java.util.Vector.add(object) which is called on a single instance passed to all the tasks. I thought that would be OK.

Since shortly after sending the email I haven't been able to get it to hang again, should it hang once more, I'll try to investigate further.

Sorry for bringing up FJTasks on the list again. In JSR166 -- is FutureTask intended to serve a similar purpose, in terms of pooled threads, and async processing?

Thanks for the info.

Ken.



                                                                                                                                                                                   
                      Doug Lea <dl@cs.oswego.edu>                                                                                                                                  
                      Sent by:                             To:       Ken Horn/DMGIT/DMG UK/DeuBa@DMG UK                                                                            
                      concurrency-interest-admin@cs        cc:       Concurrency-interest@altair.cs.oswego.edu                                                                     
                      .oswego.edu                          Subject:  Re: [concurrency-interest] Recursion -> FJTasks question                                                      
                                                                                                                                                                                   
                                                                                                                                                                                   
                      29/03/2003 16:34                                                                                                                                             
                                                                                                                                                                                   
                                                                                                                                                                                   





Hi Ken;

First, the dl.u.c Fork/Join framework won't be part of JSR-166. This
was just a decision about generality -- FJTasks are too nichy to put
into JDK. I'll continue to make them available separately though. But
anyway...

> However this sometimes never completes --
>       my taskGroup.invoke()  (on thread main), never returns, wait()ing in awaitingTermination(),
> ...

It looks like at least one of your tasks are blocking waiting for
others outside of a FJTask.join or yield, which this framework
explicitly doesn't handle.  In general, all code in the run methods of
FJTasks must be lock-free and IO-free (See my CPJ book sec 4.3 for
some discussion).  While you can in many cases get away with using
locks or IO, they require case-by-case analysis, and might not work
out in your case. (The whole idea of FJTasks is to impose non-blocking
constraitns in exchange for very fast execution on MPs). Also, make
sure that all variables viasible across tasks are declared as
volatile.  From what you wrote, I don't have a more specific
diagnosis, but hopefully this will steer you in the right direction.

-Doug
_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@altair.cs.oswego.edu
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest





--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.