Sascha Roloff <sascha.rol...@googlemail.com> wrote on 05/25/2011 06:56:08 
AM:

> 
> I have a program using more than one places. Now I am starting several
> concurrent activities on different places which execute an algorithm 
that
> needs mutual exclusion against the other activities on all other places, 
so
> it also has to communicate with the other places. Is it possible in any 
way
> to realize a mutual exclusion involving more places. 


Hmm, this doesn't sound like a parallel algorithm.  Do you really have to 
execute one activity at a time?


As to the atomic operations, X10 language spec says it guarantees mutually 
exclusive operations at the same place.  Nothing I'm aware of working for 
more than one places.


                                                       I tried already 
things
> with locks and monitors from the X10 standard library and experimented 
with
> such kind of code:
> 
> val lockRef = GlobalRef[Lock](new Lock());
> 
> for(p in Place.places()) {
>   at (p) async {
>     // enter atomic
>     at (lockRef.home) {
>       val lock = lockRef();
>       lock.lock();
>     }
>     ...
>     // leave atomic
>     at (lockRef.home) {
>       val lock = lockRef();
>       lock.unlock();
>     }
>   }
> }
> 
> I know, this is not very desirable and not very performant. 



This looks like a sequential code, but much more convoluted unfortunately. 
 Use a single global entity for lock/unlock is not scalable.  Other PGAS 
languages normally do is to use disjoint data (e.g. use DistArray) for 
locking operations.  It will yield better scalability.

But again, if your algorithm is not parallel, then choosing a "good" 
locking mechanism is a waste of time.


Cheers,


Jim Xia

Compiler Testing, X10 & XLF
IBM Toronto Lab at 8200 Warden Ave,
Markham, On, L6G 1C7
905-413-3444
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to