cs586 distributed computing tutorial 5
play

CS586: Distributed Computing Tutorial 5 Professor: Panagiota - PowerPoint PPT Presentation

CS586: Distributed Computing Tutorial 5 Professor: Panagiota Fatourou TA: Eleftherios Kosmas CSD - December 2011 Snapshots - T-Opt da data *sca ta *scan (voi n (void) { d) { void update (data value, int i) { void update (data value, int


  1. CS586: Distributed Computing Tutorial 5 Professor: Panagiota Fatourou TA: Eleftherios Kosmas CSD - December 2011

  2. Snapshots - T-Opt da data *sca ta *scan (voi n (void) { d) { void update (data value, int i) { void update (data value, int i) { data view[1..m], d1, d2; view[1..m], d1, d2; int cur int c urr_seq; _seq; int j; int j; data d1, d2; data d1, d2; seq=seq+1; seq=seq+1; curr_seq = seq; curr_seq = seq; 7. 7. 1. 1. d1 = pre[i]; d1 = pre[i]; for (j = 1; j for (j = 1; j ≤ m; j++ m; j++) { { 8. 8. 2. 2. d2 = post[curr seq][ d2 = p st[curr seq][i]; ]; d1 = pre[j]; d1 = pre[j]; 9. 9. 3. 3. if (d2 == null) if (d2 == n ll) d2 = post[seq][j]; d2 = post[seq][j]; 10. 10. 4. 4. post[curr seq][i]=d1; post[curr seq][i]=d1; if(d2 == n if(d2 == null) view[j ll) view[j]=d1; ]=d1; 5. 5. 11. 11. else view[j]=d2; else view[j]=d2; pre[i]=va pr =value; e; 6. 6. 12. 12. } } return view; ret rn view; } Initially seq = 1 seq = 1 post[1..k][1..m] = {null, null, …, null} post[1..k][1..m] = {null, null, …, null} pre[1..m] = {null, null, …, null} pre[1..m] = {null, null, …, null} CS586 Tutorial 5 by Eleftherios Kosmas 2

  3. Snapshots - T-Opt 2 m 1 m 1 2 post : pre : 1 2 k seq : CS586 Tutorial 5 by Eleftherios Kosmas 3

  4. T-Opt - Linearizability α is an execution of T-opt and S is any SCAN performed in α � w S : is the write performed by S (line 7) � seq seq S : is the value written to seq by w S � ∈ For each i {1,…, m}, � S : the read of pre[i] by S (line 9) r i � S : the read of post[seq S ][i] by S (line 10) ~r ~r i � v i : the value that S returns for component A i � S and v i at r i S If S reads null at ~r i � S : the UPDATE that writes v i to pre[i] and its write to it is the last write U i � to it that precedes r i S If S reads v i at ~r i S � S : the UPDATE that writes v i to post[seq S ][i] and its write to it is the last V i � write to it that precedes ~r i S S : the UPDATE that writes v i to pre[i] and its write to it is the last write U i � S reads pre[i] to it before V i S : the write to pre[i] by U i S (line 6) w i � CS586 Tutorial 5 by Eleftherios Kosmas 4

  5. Snapshots - T-Opt void update (data value, int i) { void update (data value, int i) { data *sca da ta *scan (voi n (void) { d) { int c int curr_seq; _seq; data view[1..m], d1, d2; view[1..m], d1, d2; data d1, d2; data d1, d2; int j; int j; curr_seq = seq; curr_seq = seq; seq=seq+1; seq=seq+1; // w // w S 1. 1. 7. 7. d1 = pre[i]; d1 = pre[i]; for (j = 1; j ≤ m; j++ for (j = 1; j m; j++) { { 2. 2. 8. 8. S d2 = post[curr seq][ d2 = p st[curr seq][i]; ]; d1 = pre[j]; d1 = pre[j]; // r // r i 3. 3. 9. 9. S if (d2 == n if (d2 == null) ll) d2 = post[seq][j]; d2 = post[seq][j]; // ~r // ~r i 4. 4. 10. 10. post[curr seq][i]=d1; post[curr seq][i]=d1; if(d2 == n if(d2 == null) view[j ll) view[j]=d1; ]=d1; 5. 5. 11. 11. pr pre[i]=va =value; // w w i S else view[j]=d2; else view[j]=d2; 6. 6. 12. 12. } } ret return view; rn view; } Initially seq = 1 seq = 1 post[1..k][1..m] = {null, null, …, null} post[1..k][1..m] = {null, null, …, null} pre[1..m] = {null, null, …, null} pre[1..m] = {null, null, …, null} CS586 Tutorial 5 by Eleftherios Kosmas 5

  6. T-Opt - Linearization points � Each SCAN S is linearized at w S ∈ � For each i {1,…, m}, S follow w S , � if w i S is linearized just before w � U i just before w S � each UPDATE on A i that performs its write to pre[i] between S is linearized just before w w S and w i just before w S � ties are broken by the order that the writes to pre[i] occur � each of the rest of UPDATES is linearized at its write to pre[i] write to pre[i] (line 6) CS586 Tutorial 5 by Eleftherios Kosmas 6

  7. T-Opt - Linearizability: Intuition T-Opt is linearizable linearizable A. A. The linearization point of each operation is within its execution within its execution interval interval Intuition : � SCANs? � UPDATEs linearized when they write to pre[i]? � UPDATEs linearized before the linearization point of some SCAN? B. B. Scans returns consistent vectors consistent vectors Intuition : (v i is written by the last UPDATE linearized before SCAN) S follows w S ? � if w i S precedes w S ? � if w i hint : the linearization order of UPDATEs on A i respects the order of writes to pre[i] (by those UPDATEs) CS586 Tutorial 5 by Eleftherios Kosmas 7

  8. T-Opt - Linearizability: sketch of proof T-Opt is linearizable linearizable A. A. The linearization point of each operation is within its execution within its execution interval interval S follows w S , then the execution of an UPDATE that performs A.1. If w i S (including U i S ) starts before w S its write to pre[i] between w S and w i B. B. Scans returns consistent vectors consistent vectors B.1. The linearization order of the UPDATES on any component A i respects the order in which these UPDATES perform their writes to pre[i] CS586 Tutorial 5 by Eleftherios Kosmas 8

  9. T-Opt - Technical Lemmas ∈ S follows w S Lemma 1. For each i {1,…,m}, ~r Lemma 1 ~r i follows w i sketch of proof S precedes w S … � if w i S follows w S � if w i S and v i at r i S … Assume, S reads null at ~r i � S … Assume, S reads v i at ~r i � S , and let r pre be the read of pre[i] Lemma 2 Lemma 2. Assume that S reads v i at ~r i S . Then, r pre by V i pre follows w follows w S sketch of proof � Assume, by the way of contradiction, that r pre is executed before w S S precedes w S … � Then, the read of seq by V i CS586 Tutorial 5 by Eleftherios Kosmas 9

  10. T-Opt ∈ S follows w S , it Lemma A.1. For each i {1,…,m}, such that w i Lemma A.1 holds that any UPDATE on A i that performs its write to pre[i] S (including U i S ) begins its execution before between w S and w i w S sketch of proof � Assume, by the way of contradiction, that there is an UPDATE U on A i that starts its execution after w S and performs its write to pre[i] (let it be S w) before w i � U reads seq S in seq � Lemma 1 � U ends its execution before the end of S � U starts after w S S � S read a value other than null at ~r i � U executes lines 4-5 before w (which precedes w i S ) S reads a value other than null in post[seq S ][i] � V i CS586 Tutorial 5 by Eleftherios Kosmas 10

  11. T-Opt Lemma A. Lemma A. Let α be any execution of T-Opt. The linearization point of any SCAN or UPDATE executed in α is within its execution interval sketch of proof � SCANs � UPDATEs linearized at their writes to pre � Let U be an update on A i which is not linearized at its write to pre[i] � There is a SCAN S such that S is executed after w S w i � the write to pre[i] by U is executed between w S and w i S � U is linearized just before w S � � Lemma A.1. � U begins its execution before w S CS586 Tutorial 5 by Eleftherios Kosmas 11

  12. T-Opt Lemma B.1 Lemma B.1. Let U 1 , U 2 be two update on some component A i , 1 ≤ i ≤ m. Denote by w 1 the write to pre[i] by U 1 and by w 2 the write to pre[i] by w 2 . If w 1 precedes w 2 , the linearization point of U 1 precedes the linearization point of U 2 sketch of proof � Assume, by the way of contradiction, that the claim does not hold � U 1 and U 2 are linearized at their writes to pre[i]… � At least one of the U 1 , U 2 is not linearized at its write to pre[i] U 2 is linearized at w 2 … ( hint: use Lemma A. ) � U 1 is linearized at w 1 � U 2 can not be linearized at w 2 (why?) � Therefore a SCAN S exists such that � S w 2 has been performed between w S and w i � S , since w 1 precedes w 2 w 1 precedes w i � if w 1 follows w S … � if w 1 precedes w s … ( hint: use Lemma A. ) � CS586 Tutorial 5 by Eleftherios Kosmas 12

  13. T-Opt Lemma B.1 Lemma B.1. Let U 1 , U 2 be two update on some component A i , 1 ≤ i ≤ m. Denote by w 1 the write to pre[i] by U 1 and by w 2 the write to pre[i] by w 2 . If w 1 precedes w 2 , the linearization point of U 1 precedes the linearization point of U 2 sketch of proof � None of U 1 , U 2 is linearized at its write to pre[i] Two SCANS S1 and S2 exist such that � S1 w 1 has been performed between w S1 and w i � S2 w 2 has been performed between w S2 and w i � if S1 = S2 … � if S1 follows S2 … � S2 precedes the end of S2 Lemma 1 � w i � if S1 precedes S2 … � S1 precedes the end of S1 Lemma 1 � w i � CS586 Tutorial 5 by Eleftherios Kosmas 13

  14. T-Opt Lemma B Lemma B. Let α be any execution of T-Opt. Any SCAN executed in α returns a consistent vector sketch of proof S store v i in component A i and its linearization point � Recall that U i precedes the linearization point of S ∈ � Assume, by the way of contradiction, that there is an integer i {1,…,m} such that the last UPDATE on A i which has been linearized before S is not U i S denote by U this update and let w be the write to pre[i] by U � S � w follows w i � if w precedes w i S , Lemma B.1. implies that U is linearized before U i S S and v i at r i S � S reads null at ~r i U can not be linearized at w � S (why?) � w follows r i � U is linearized before S, and S is linearized at w S CS586 Tutorial 5 by Eleftherios Kosmas 14

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend