{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Notes09

Notes09 - Chapter 18[18 Concurrency Control CS 245 Database...

This preview shows pages 1–4. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 245 Notes 09 7 Schedule D T1 T2 Read(A); A A+100 Write(A); Read(A);A A × 2; Write(A); Read(B);B B × 2; Write(B); Read(B); B B+100; Write(B); A B 25 25 125 250 50 150 250 150 CS 245 Notes 09 8 Schedule E T1 T2’ Read(A); A A+100 Write(A); Read(A);A A × 1; Write(A); Read(B);B B × 1; Write(B); Read(B); B B+100; Write(B); A B 25 25 125 125 25 125 125 125 Same as Schedule D but with new T2’ CS 245 Notes 09 9 • Want schedules that are “good”, regardless of – initial state and – transaction semantics • Only look at order of read and writes Example: Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B) CS 245 Notes 09 10 Sc’=r 1 (A)w 1 (A) r 1 (B)w 1 (B)r 2 (A)w 2 (A)r 2 (B)w 2 (B) T 1 T 2 Example: Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B) CS 245 Notes 09 11 However, for Sd: Sd=r 1 (A)w 1 (A)r 2 (A)w 2 (A) r 2 (B)w 2 (B)r 1 (B)w 1 (B) • as a matter of fact, T 2 must precede T 1 in any equivalent schedule, i.e., T 2 T 1 CS 245 Notes 09 12 T 1 T 2 Sd cannot be rearranged into a serial schedule Sd is not “equivalent” to any serial schedule Sd is “bad” T 2 T 1 Also, T 1 T 2
CS 245 Notes 09 13 Returning to Sc Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B) T 1 T 2 T 1 T 2 no cycles Sc is “equivalent” to a serial schedule (in this case T 1 ,T 2 ) CS 245 Notes 09 14 Concepts Transaction: sequence of r i (x), w i (x) actions Conflicting actions: r 1(A) w 2(A) w 1(A) w 2(A) r 1(A) w 2(A) Schedule: represents chronological order in which actions are executed Serial schedule: no interleaving of actions or transactions CS 245 Notes 09 15 What about concurrent actions? Ti issues System Input(X) t x read(x,t) issues completes input(x) time T2 issues write(B,S) System issues input(B) input(B) completes B S System issues output(B) output(B) completes CS 245 Notes 09 16 So net effect is either • S=…r 1 (x)…w 2 (b)… or • S=…w 2 (B)…r 1 (x)… CS 245 Notes 09 17 • Assume equivalent to either r 1 (A) w 2 (A) or w 2 (A) r 1 (A) low level synchronization mechanism • Assumption called “atomic actions” What about conflicting, concurrent actions on same object?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 21

Notes09 - Chapter 18[18 Concurrency Control CS 245 Database...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online