简体   繁体   English

执行的示例,它是顺序一致但不是静止一致的

[英]Example of execution which is sequentially consistent but not quiescently consistent

In the context of correctness of concurrent programs, Sequential consistency is stronger condition than quiescent consistency according to The art of multiprocessor programming by Maurice Herlihy and Nir Shavit(chapter 3) Authors also mention in 3.4.1 that there are sequentially consistent executions that are not quiescently consistent. 在并发程序的正确性的背景下,顺序一致性是比静态一致性更强的条件,根据Maurice Herlihy和Nir Shavit的多处理器编程技术(第3章)作者在3.4.1中也提到有顺序一致的执行不是静止一致。 I don't understand how. 我不明白怎么做。 Could somebody throw a light or provide sample execution ? 有人可以投光还是提供样品执行?

Consider a queue (FIFO) to which you enqueue and dequeue elements. 考虑一个队列(FIFO) ,您将元素排入队列并使其出列。

From this dissertation about concurrency, I read (p.20): 这篇关于并发的论文中 ,我读到了(第20页):

An example of a scenario that is allowed in the sequential consistency model and disallowed in the quiescent consistency model is shown in Figure 2.1. 序列一致性模型中允许且静态一致性模型中不允许的场景示例如图2.1所示。 Two processes share a concurrent queue data structure. 两个进程共享并发队列数据结构。 The first process enqueues x. 第一个进程排队x。 At some non-overlapping subsequent interval, a second process enqueues y. 在某些非重叠的后续间隔中,第二个过程将y排队。 Finally the second process performs a dequeue and receives y. 最后,第二个进程执行出队并接收y。 This example is sequentially consistent but is not quiescently consistent, assuming that the time between enqueue operations falls outside the quiescence interval. 假设排队操作之间的时间超出静止间隔,此示例是顺序一致但不是静态一致的。

Figure 2.1: 图2.1:

 T1: --- enq(x) --------------------------- T2: ------------- enq(y) ---- deq():y ---- 

This history is permitted by sequential consistency, can be either permitted or forbidden by quiescent consistency, and is forbidden by linearizable consistency. 此历史记录是通过顺序一致性允许的,可以是静态一致性允许或禁止的,并且可以通过线性化一致性来禁止。

If you assume that between the two enqueue the queue was quiescent, then T2 should see the changes from T1, and the dequeue should return x. 如果你假设在两个队列之间队列是静止的,那么T2应该看到T1的变化,并且dequeue应该返回x。 If you assume there was no quiescent interval between the two enqueues, then two enqueues can be reorderd as you wish, and deq():y is consistent. 如果假设两个队列之间没有静止区间,则可以根据需要重新排序两个队列,并且deq():y是一致的。

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

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