哪些CPU体系结构支持比较和交换(CAS)?

编程入门 行业动态 更新时间:2024-10-10 08:21:06
本文介绍了哪些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)?

本文发布于:2023-11-12 01:50:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580173.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:体系结构   CPU   CAS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!