Is all this Invarient **** er... stuff, premature optimisation?

Sean Kelly sean at invisibleduck.org
Tue Apr 29 16:30:37 PDT 2008


== Quote from Me Here (p9e883002 at sneakemail.com)'s article
> Sean Kelly wrote:
> > == Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> > > Me Here wrote:
> > > > If that describes copy-swap then yes. Else no :)
> > > copy-swap is what lock free algorithms rely on for updating a data
> > > structure. It's at the root of STM, and even has its own TLA, CAS (Copy
> > > And Swap).
> >
> > I believe CAS actually stands for "compare and swap" or "compare and set"
> > depending on who you talk to.  RCU is probably a more popular algorithm
> > for copy and swap--it's used in the Linux kernel quite a bit.  It stands for
> > "read, copy, update," I believe.
> >
> >
> > Sean
> From the litrature I found, CAS is (was originally) the name of the opcode
> used on a Sun microprocessor to conditionally and atomically swap the contents
> of two words of memory (or maybe memory and register).
> It also mentions a CASX opcode, and a LL/SC (Load Linked / Store
> Conditional) pairing that can be used as alternatives.

Yeah, LL/SC is pretty cool.  The hardware transactional memory proposals I've
seen are like LL/SC on steroids.  Bit more flexible than CAS, but either works.


Sean



More information about the Digitalmars-d mailing list