2016-10-11 10 views
0

次の逐次性が一貫していますか?逐次的一貫性

P1:W(x)1 R(x)1 ----------------------- R (x)は1

P2:W(X)2 ------------- R(X)2 R(x)は1

P3:W(X)R 3 (x)3 ---------------------- R(x)1

これは、プログラムの注文が個人によって満たされているのでプロセッサ

答えて

0

いいえ、th連続的に一貫したトレースではありません。

逐次一致するためには、それぞれのプロセスの操作がプログラム順に実行される等価な法律トレースが存在する必要があります。そしてトレースは法律であり、それが連続していて、各レジスタXへの読み取りは最後に書き込まれた値を返します。

我々は法的トレースを構築することができますが、その中にP2とP3の操作は、そのプログラムの順序と一致しませんが(リターン1は書き込み前に並べ替えなければならなかったことを読み込む):

満たすためにしようと
P1: W(X, 1) 
P1: R(X) → 1 
P1: R(X) → 1 
P2: R(X) → 1 
P3: R(X) → 1 
P2: W(X, 2) 
P2: R(X) → 2 
P3: W(X, 3) 
P3: R(X) → 3 

どちらのプロパティも可能ではないことがわかります:

// it doesn't matter where we start really: P1, P2 or P3 
// (but with P2 and P3 the seq. consistent part of the trace would be even shorter) 
// let's go with P1 
P1: W(X, 1) 

// now the next read has to see X=1 so the trace remains legal 
P1: R(X) → 1 
// and again 
P1: R(X) → 1 

// no more P1's operations, 
// have to chose first op in either P1's or P2's program order 
// let's go with P2 
P2: W(X, 2) 

// now the next read has to see X=2 so the trace remains legal 
P2: R(X) → 2 // great! 

// at this point there's no operation that would keep the trace legal 
// except P3's W(X, 3) 
P3: W(X, 3) 

// there's only three reads left and the next one should see X=3 
P3: R(X) → 3 // yay! 

// but the last two reads ruin everything 
P2: R(X) → 1 // not seq. consistent! (because isn't legal) 
P3: R(X) → 1 // again, not seq. consistent!