简体   繁体   English

静态一致但顺序不一致的程序顺序示例?

[英]example of a program order which is quiescently consistent but sequentially inconsistent?

The author mentions in the book The art of multiprocessor programming by Maurice Herlihy and Nir Shavit(chapter 3) that sequential consistency and quiescent consistency are unrelated,and there are examples of program orders which are one but not the other. 作者在Maurice Herlihy和Nir Shavit撰写的《多处理器编程的艺术》(第3章)中提到,顺序一致性和静态一致性是不相关的,并且有一些程序顺序示例是彼此无关的。 Is there an example of a program order which is quiescently consistent but sequentially inconsistent ? 是否有一个程序顺序静态一致但顺序不一致的示例?

I'm also reading the book, and I'll try to explain my understanding of this problem. 我也在读这本书,我将尽力解释我对这个问题的理解。 I still don't have the whole picture in my head so there is a chance that I got something wrong :) 我仍然不了解整个图片,因此有可能我出了点问题:)

Anyway, take a look at Figure 3.8 from the book. 无论如何,请看本书中的图3.8。 The example shows that composition is not sequentially consistent. 该示例显示组成顺序不一致。 If you understand the example, you have a sequentially inconsistent execution. 如果您理解该示例,则顺序执行前后不一致。

This example as-is is not quiescently consistent. 此示例原样不是静态一致的。 Let's try to change it make it quiescently consistent, but still sequentially inconsistent. 让我们尝试更改它,使其保持静态一致,但仍然顺序不一致。 All we need to do is to prolong the method calls of thread B to overlap with the calls from thread A. For example q.enq(y) in thread B should overlap with p.enq(x) and q.enq(x) , p.enq(y) in thread B should overlap with q.enq(x) and p.deq(y) and q.deq(x) in thread B should overlap with p.deq(y) . 我们要做的就是延长线程B的方法调用,使其与线程A的调用重叠。例如,线程B中的q.enq(y)应该与p.enq(x)q.enq(x)重叠,线程B中的p.enq(y)应该与q.enq(x)重叠,线程B中的p.deq(y)q.deq(x)应该与p.deq(y)重叠。

Now, the same argument is valid: this system is not sequentially consistent. 现在,相同的论点是有效的:该系统不是顺序一致的。 However, the system is quiescently consistent because everything overlaps and therefore there are no restrictions on the order of events. 但是,系统是静态一致的,因为所有内容都重叠,因此对事件的顺序没有任何限制。

So we found an execution that is quiescently consistent but not sequentially. 因此,我们发现执行是静态一致的,但不是顺序执行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM