哪些CPU体系结构支持比较和交换(CAS)? [英] Which CPU architectures support Compare And Swap (CAS)?

查看:144
本文介绍了哪些CPU体系结构支持比较和交换(CAS)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是好奇地知道哪些CPU体系结构支持比较和交换原子基元?

just curious to know which CPU architectures support compare and swap atomic primitives?

推荐答案

Powerpc具有更强大的原语:"lwarx"和"stwcx"

Powerpc has more powerful primitives available: "lwarx" and "stwcx"

lwarx从内存中加载一个值,但会记住该位置.任何其他触摸该位置的线程或CPU都会导致条件存储指令"stwcx"失败.

lwarx loads a value from memory but remembers the location. Any other thread or cpu that touches that location will cause the "stwcx", a conditional store instruction, to fail.

因此lwarx/stwcx组合允许您实现原子增量/减量,比较和交换,以及更强大的原子操作,例如原子增量循环缓冲区索引"

So the lwarx /stwcx combo allows you to implement atomic increment / decrement, compare and swap, and more powerful atomic operations like "atomic increment circular buffer index"

这篇关于哪些CPU体系结构支持比较和交换(CAS)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆