I would guess, the "when(B)" is implemented using Java wait-notify
framework, or similar mechanism, something like:
// Acquire the lock
synchronized(<the place-global lock>) {
while(!B) {
wait(); // At this point it releases the place-global lock,
and so other threads can enter the same piece of code for the different
instance of B
}
B = true;
}
...................
// release the lock
synchronized(<the place-global lock>) {
B = true;
notify();
}
On 11/16/2012 5:32 PM, Saliya Ekanayake wrote:
As far as I understand, the locking for *when(B) S* code should be
similar *atomic S*. So if one activity is checking the condition in
*when(B) S *in one object all other activities trying to check it will
block irrespective to on what instances they check.
However, I too thought it should not add a considerable overhead as
the blocking happens to on a quick test and set.
Thank you,
Saliya
On Fri, Nov 16, 2012 at 5:03 PM, LEONID ILYEVSKY
<leonidilyev...@yahoo.com <mailto:leonidilyev...@yahoo.com>> wrote:
Now I don't quite understand. Setting the flag is quick, therefore
many activities can work in parallel on multiple objects between
setting and unsetting the flag. Only some activities will have to
wait if they want to access the object that is currently busy.
Or am I missing something here? If one activity is waiting for the
busy one at the "when" statement, does it affect another activity
which is checking different instance of the flag? If that other
instance is not busy, can it enter the "when" block?
------------------------------------------------------------------------
*From:* Saliya Ekanayake <esal...@gmail.com
<mailto:esal...@gmail.com>>
*To:* Mailing list for users of the X10 programming language
<x10-users@lists.sourceforge.net
<mailto:x10-users@lists.sourceforge.net>>
*Sent:* Friday, November 16, 2012 4:43 PM
*Subject:* Re: [X10-users] Atomic blocks
Yes I agree, that in the workaround I posted, setting the flag is
still be dependent on the single lock.
I wonder if there's some documentation to x10.util.concurrent package?
Thank you,
Saliya
On Fri, Nov 16, 2012 at 4:09 PM, Vijay Saraswat
<vi...@saraswat.org <mailto:vi...@saraswat.org>> wrote:
On 11/16/12 3:58 PM, LEONID ILYEVSKY wrote:
Saliya suggested to use boolean flag to guard the critical
session, set it in the "when" block and unset it in "atomic".
Looks like a solution virtually equivalent to java's
synchronization. What do you think?
This wont give the performance you want because of the current
single-lock-per-place implementation (see Dave Cunningham's
message).
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a
single
web console. Get in-depth insight into apps, servers,
databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
<mailto:X10-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/x10-users
--
Saliya Ekanayake
http://www.esaliya.blogspot.com
http://www.esaliya.wordpress.com
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases,
vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
<mailto:X10-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/x10-users
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases,
vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
<mailto:X10-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/x10-users
--
Saliya Ekanayake
http://www.esaliya.blogspot.com
http://www.esaliya.wordpress.com
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users