mohammed elsaeedy wrote: > Dear Krishna, > > > Thank you very much for your reply, and yes it seems very convincing, > but do you know how to modify my code > to be divided to two phases? I mean how to divide the loop part into two > parts (which are the 2 threads) > > > Suppose you have the program::
finish for ((i) in 0..N-1) async doComputation(i); where N is very large. This will spawn N asyncs. Now you only have P cores. So you can write this as: val step = N/P; finish for ((p) in 0..P-1) async for ((i) in step*p..step*(p+1)-1) doComputation(i); This will spawn only P asyncs, but all the original work will get done. This will give you the same result as the first (but better performance) provided that doComputation(i) does not throw any exceptions. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users