If you truly need a triple compare and swap then PLO will not help you. But if
you need a disjoint double compare and swap, you use the compare-and-swap
field as a counter and then you con do a compare swap and double store.

Example:

     Fetch counter
A   PLO  compare-and-fetch value1
     CC>0, go to A
     PLO  compare-and-fetch value 2
     CC>0, go to A
     calculate new value1 and 2
     Add one to fetched counter
     PLO CSDST fetched-counter new-fetched-counter, new value1, new-value2
     CC>0, go to A

This requires that all processes that update value1 or value2 use PLO with the
same lock word.

On Sun, 3 Nov 2013 19:58:12 -0800 Jon Perryman <jperr...@pacbell.net> wrote:

:>I sure missed that one with the locks. 
:>
:>PLO CDS does exactly what is wanted.  It does 2 CS's within the locked 
instruction. 
:>
:>PLO CSDST on the other hand only does a single CS followed by 2 ST's. Since 3 
separate load instructions (not under PLO control) are required when not in 
contiguous storage, there is not any method that will guarantee the 3 values 
are consistent with the others. A counter as suggested by Peter Relson won't 
help either for this same reason.
:>
:>
:>I can't think of a situation where PLO CSDST is useful. Can anyone describe a 
situation where it is useful?
:>
:>Jon Perryman.
:>
:>
:>
:>>________________________________
:>> From: Rob Scott <rsc...@rocketsoftware.com>
:>>
:>>
:>>
:>>I think the OP stated that his code could hold locks - in which case the 
latch services cannot be used.
:>>
:>
:>----------------------------------------------------------------------
:>For IBM-MAIN subscribe / signoff / archive access instructions,
:>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
Binyamin Dissen <bdis...@dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to