What are the differences between sequential consistency and quiescent consistency?

前端 未结 2 962
暗喜
暗喜 2021-02-12 12:42

Can anyone explain me the definitions and differences between sequential consistency and quiescent consistency? In the most dumb form possible :|

I did

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-12 13:09

    Sequential consistency requires that the operations should appear to take effect in the order they are specified in each program. Basically it enforces program order within each individual process, and allows all processes to assume they are observing the same order of operations. Let's say we have 2 processes enqueuing and dequeuing items on a queue q:

    P1 -- q.enq(x) ----------------------------- 
    P2 -------------- q.enq(y) ---- q.deq():y --
    

    This is not the expected behaviour from a FIFO queue. We'd expect to dequeue x because P1 enqueues x before P2 enqueues y. However this scenario is allowed in the sequential consistency model because sequential consistency doesn't require that the order seen by all processes is correct (real-time order). There's at least one sequential execution that can explain these results and one is:

    P2:q.enq(y) P1:q.enq(x) P2:q.deq():y
    

    In this execution each process executes operations in program order meaning each process executes its operations in the order they're specified in each process.

    Quiescent consistency requires non-overlapping operations to appear to take effect in their real-time order, but overlapping operations might be reordered. Therefore, the same scenario is not allowed in the quiescent consistency model because we expect q.enq(x) to appear to take effect before q.enq(y), and q.deq() to return x instead of y. Also quiescent consistency doesn't necessarily preserve program order. If q.enq(x) and q.enq(y) would be concurrent (overlapping) operations, they could be reordered and q.deq():y would be quiescently consistent.

    Basically some executions are sequentially consistent but not quiescently consistent, and vice versa.

提交回复
热议问题