Hacker News new | ask | show | jobs
by chrisseaton 3381 days ago
> CAS is "lock free" only in the sense that it doesn't require the processor to stop the world in order to flip the mutex boolean

No, CAS is lock free in the sense that a process or thread that freezes for whatever reason while doing a CAS operation cannot cause the entire system to stop making progress (provided your hardware is working as intended).

That's the only thing that matters to say if something is 'lock free' or not, and CAS meets that definition.

If you want some other property that's fine, but that's not what anyone understands by 'lock free'.

1 comments

Right, I think you looked past what I said, and why I put "lock free" in quotes:

> I don't like usage of the term "lock free" to mean "locks that are less costly".

There's a difference between being formally "lock free" meaning "the system is guaranteed to not globally deadlock", and this informal use of "lock free" meaning "CAS is more efficient because it doesn't block execution of other threads in obtaining a mutex"

This article's intro:

  Data structures (and their corresponding methods) implemented with coarse grained locks
  are hard to scale in highly parallel environments and workloads where the structure is required
  to be accessed by several concurrent threads simultaneously (parallelism).
is talking about performance, not termination guarantees, and that muddles the meaning of "lock free".