Hello,

Greetings from me!

I am reading  "3.2.2 Costs of Operations" in perf book, and come
across following words:

> The same-CPU compare-and-swap (CAS) operation consumes about seven 
> nanoseconds, a duration more than ten times that of the clock period. 
> ......CAS functionality is provided by the lock; cmpxchg instruction on x86.
> ...... Similarly, the same-CPU lock operation (a “round trip” pair consisting 
> of a lock acquisition and release) consumes more than fifteen nanoseconds,or 
> more than thirty clock cycles. The Lock Operation Is more expensive than CAS 
> because it requires two atomic operations on the lock data structure,

So my question is for the "lock" operation in the above paragraph,
does it mean "lock" instruction? Because the CAS functionality is
"lock; cmpxchg" on x86, a single "lock" instruction should consume
less time than "lock; cmpxchg". Or I misunderstood something? Thanks
very much in advance!

Best Regards
Nan Xiao

Reply via email to