ARM单拷贝原子性 [英] ARM single-copy atomicity

查看:199
本文介绍了ARM单拷贝原子性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究ARMv7内核的ARM体系结构手册.在有关内存访问原子性的第A3.5.3章中,它指出:

I am currently wading through the ARM architecture manual for the ARMv7 core. In chapter A3.5.3 about atomicity of memory accesses, it states:

如果单副本原子负载与单副本原子存储重叠,并且 对于任何重叠字节,负载将返回由写入的数据 写入由该字节插入到该字节的一致性顺序中 单拷贝原子存储,那么加载必须从某个点返回数据 按照连贯性顺序,不得早于插入到 所有单原子原子存储的一致性顺序 重叠的字节.

If a single-copy atomic load overlaps a single-copy atomic store and for any of the overlapping bytes the load returns the data written by the write inserted into the Coherence order of that byte by the single-copy atomic store then the load must return data from a point in the Coherence order no earlier than the writes inserted into the Coherence order by the single-copy atomic store of all of the overlapping bytes.

作为非英语母语者,我承认我在理解这句话时遇到了一些挑战.

As non-native english speaker I admit that I am slightly challenged in understanding this sentence.

是否存在未按一致性顺序插入对存储字节的写入的情况,因此上述情况不适用吗?如果不是,我是否正确地说是将句子缩短和改写为以下内容:

Is there a scenario where writes to a memory byte are not inserted in the Coherence Order and thus the above does not apply? If not, am I correct to say that shortening and rephrasing the sentence to the following:

如果加载恰好返回了至少一个字节 写操作,那么加载必须返回一个点的所有重叠字节 不早于写入将它们插入到的位置 所有重叠字节的一致性顺序.

If the load happens to return at least one byte of the the write, then the load must return all overlapping bytes from a point no earlier than where the write inserted them into the Coherence order of all of the overlapping bytes.

仍然传达相同的意思吗?

still transports the same meaning?

推荐答案

我看到了ARMv8 ARM中的措辞,该措辞实际上试图消除很多地方的任何歧义(即使确实使内存排序部分成为现实)无法读取).

I see that wording in the ARMv8 ARM, which really tries to remove any possible ambiguity in a lot of places (even if it does make the memory ordering section virtually unreadable).

就一般理解而言(相对于实际上实施规范而言),一点点的歧义并不总是有害的,因此尽管不能完全做到 清楚内存位置"的含义,在这种情况下,我认为旧的v7手册(DDI0406C.b)更好看:

In terms of general understanding (as opposed to to actually implementing the specification), a little bit of ambiguity doesn't always hurt, so whilst it fails to make it absolutely clear what a "memory location" means, I think the old v7 manual (DDI0406C.b) is a nicer read in this case:

如果同时满足以下两个条件,则读或写操作是单拷贝原子操作:

A read or write operation is single-copy atomic if the following conditions are both true:

  • 对某个存储位置执行任何数量的写操作之后,该存储位置的值就是其中一个写操作所写的值.

  • After any number of write operations to a memory location, the value of the memory location is the value written by one of the write operations. It is impossible for part of the value of the memory location to come from one write operation and another part of the value to come from a different write operation

当在同一存储位置上进行读操作和写操作时,通过读操作获得的值是以下值之一:

When a read operation and a write operation are made to the same memory location, the value obtained by the read operation is one of:

  • 写操作之前的内存位置值
  • 写操作后的内存位置值.

永远不会出现读操作的值部分是写操作之前的存储位置的值,而部分是写操作之后的存储位置的值的情况.

It is never the case that the value of the read operation is partly the value of the memory location before the write operation and partly the value of the memory location after the write operation.

所以您的理解是正确的-单拷贝原子操作的定义点是,在任何给定时间,您只能看到它的 all none >.

So your understanding is right - the defining point of a single-copy atomic operation is that at any given time you can only ever see either all of it, or none of it.

在v7中有一种情况(如果我正确解释的话),两个同时出现在同一位置但大小不同的通常为单拷贝的原子存储会破坏原子性的任何保证,因此从理论上讲,您可能在那里观察到一些意外的字节混合-在v8中似乎已将其删除.

There is a case in v7 whereby (if I'm interpreting it right) two normally single-copy atomic stores that occur to the same location at the same time but with different sizes break any guarantee of atomicity, so in theory you could observe some unexpected mix of bytes there - this looks to have been removed in v8.

这篇关于ARM单拷贝原子性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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