Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
LL/SC 在计算机体系结构中与 CAS(比较和交换)相比有什么优势?我认为 LL/SC 可以在多核系统中解决活锁问题,并解决 ABA 问题,但 CAS 不能。与 CAS 相比,我找不到 LL/SC 的任何优势。谁能告诉我?
由于没有人回答,LL/SC 不会遇到 ABA 问题,因为如果 LL 引用的地址被修改,条件存储将失败。此外,它不能活锁,因为一个或多个 LL/SC 对失败意味着另一个成功。CAS 也可能更昂贵,因为它可能需要刷新无效队列。