数据库系统实现(第二版_英文版)部分答案要点.pptVIP

  • 27
  • 0
  • 约2.16万字
  • 约 68页
  • 2017-02-13 发布于湖北
  • 举报

数据库系统实现(第二版_英文版)部分答案要点.ppt

(T1,T2) R(A,t);t:=t+2;W(A,t); R(A,s);s:=s+3;W(A,s); R(B,t);t:=t*3;W(B,t); R(B,s);s:=s*2;W(B,s) 2 serial schedules and 402 serializable schedules (T1, T2): T1: R(A,t);t:=t+2;W(A,t); | R(B,t);t:=t*3;W(B,t); A0+2 3B0 T2: R(B,s);s:=s*2;W(B,s); | R(A,s);s:=s+3;W(A,s); 6B0 A0+5 (T2, T1): T2: R(B,s);s:=s*2;W(B,s); | R(A,s);s:=s+3;W(A,s); 2B0 A0+3 T1: R(A,t);t:=t+2;W(A,t); | R(B,t);t:=t*3;W(B,t); A0+5 6B0 The three writes create three versions of A. When T2 tries to read A, it is given the value that it itself wrote, since that is the version with the greatest timestamp that does not exceed the timestamp of T2. That makes sense, although in practice, we doubt that a well written transaction would read its own value through the database storage system. When T4 tries to read A the system finds that T4s timestamp is larger than that of any version of A written. Thus, T4 gets the version with the largest of the timestamps, the one written by T3. That makes sense, because in the hypothetical serial order based on the timestamps of the transactions, T3 would be the last to write A. As T1 is the first to validate, there is nothing to check; T1 validates successfully. T3 validates next. The only other validated transaction is T1, and T1 has not yet finished. Thus, both the read- and write-sets of T3 must be compared with the write-set of T1. However, T1 writes only A, and T3 neither reads nor writes A, so T3s validation succeeds. Last, T2 validates. Both T1 and T3 finish after T2 started, so we must compare the read-set of T2 with the write-sets of both T1 and T3. Since B is in both W3 and R2, we cannot validate T2. Note that since T3 (but not T1) finishes after T2 validates, we would also compare the write set of T2 with the write set of T3, ha

文档评论(0)

1亿VIP精品文档

相关文档