My understanding is with multi-threading it is possible that the updates to the fields may be out of order and thus it is possible to fetch the updated counter with the unupdated value1. PLO serializes it.
On Mon, 4 Nov 2013 07:46:51 -0800 Jon Perryman <jperr...@pacbell.net> wrote: :>Thanks Binyamin. Also a great example but it brings me to another question. What is the advantage of using PLO compare and fetch? Is it just saving CPU time in the case where the counter has changed? Is there another advantage that I'm not thinking about? :> :>Jon Perryman. :> :> :> :>>________________________________ :>> From: Binyamin Dissen <bdis...@dissensoftware.com> :>> :>> :>> :>>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 :>> :>> :>> :> :>---------------------------------------------------------------------- :>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