Presentation is loading. Please wait.

Presentation is loading. Please wait.

V. Megalooikonomou Concurrency Control – Deadlocks (based on slides by C. Faloutsos at CMU and on notes by Silberchatz,Korth, and Sudarshan) Temple University.

Similar presentations


Presentation on theme: "V. Megalooikonomou Concurrency Control – Deadlocks (based on slides by C. Faloutsos at CMU and on notes by Silberchatz,Korth, and Sudarshan) Temple University."— Presentation transcript:

1 V. Megalooikonomou Concurrency Control – Deadlocks (based on slides by C. Faloutsos at CMU and on notes by Silberchatz,Korth, and Sudarshan) Temple University – CIS Dept. CIS616– Principles of Data Management

2 Isolation - concurrency control serializability correctness precedence graph automatically correct interleavings: locks + protocol (2PL, 2PLC) but: deadlocks!

3 Deadlocks detection handling (prevention)

4 Deadlock detection T1 T2 lock manager L(A) Yes L(B) Yes... L(B) No L(A) No time DEADLOCK

5 Algorithm for deadlock detection? wait-for graph: nodes  transactions arcs  Tsource waits for Tsink if cycle, then deadlock! Must invoke a deadlock-detection algorithm periodically to look for cycles

6 Example T1 T2 lock manager L(A) Yes L(B) Yes... L(B) No L(A) No time T1T2 ‘A’ ‘B’ for ‘B’ for ‘A’

7 Another example T1T2 T3 T4 is there a deadlock? if yes, which xacts are involved?

8 Another example T1T2 T3 T4 now, is there a deadlock? if yes, which xacts are involved?

9 Deadlock detection how often should we run the algorithm? how many transactions are typically involved?

10 Deadlock handling T1T2 T3 T4 Q: what to do?

11 Deadlock handling T1T2 T3 T4 Q0: what to do? A: select a ‘victim’ & ‘rollback’ Q1: which/how to choose?

12 Deadlock handling Q1: which/how to choose? A1.1: by age A1.2: by progress A1.3: by # items locked already... A1.4: by # xacts to rollback Q2: How far to rollback? T1T2 T3 T4

13 Deadlock handling Q2: How far to rollback? A2.1: completely A2.2: minimally Q3: Starvation?? T1T2 T3 T4

14 Deadlock handling Q3: Starvation?? A3.1: include #rollbacks in victim selection criterion T1T2 T3 T4

15 SQL statement usually, conc. control is transparent to the user, but LOCK [EXCLUSIVE|SHARED]

16 Concurrency control - conclusions serializability correctness automatically correct interleavings: locks + protocol (2PL, 2PLC,...) deadlock detection + handling

17 Conclusions serializable schedules 2PL schedules serializable schedules serial sch’s2PLC


Download ppt "V. Megalooikonomou Concurrency Control – Deadlocks (based on slides by C. Faloutsos at CMU and on notes by Silberchatz,Korth, and Sudarshan) Temple University."

Similar presentations


Ads by Google