C. Faloutsos Concurrency control - deadlocks

Slides:



Advertisements
Similar presentations
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Advertisements

1 Concurrency Control III Dead Lock Time Stamp Ordering Validation Scheme.
Database Systems (資料庫系統)
Unit 9 Concurrency Control. 9-2 Wei-Pang Yang, Information Management, NDHU Content  9.1 Introduction  9.2 Locking Technique  9.3 Optimistic Concurrency.
Chapter 16 Concurrency. Topics in this Chapter Three Concurrency Problems Locking Deadlock Serializability Isolation Levels Intent Locking Dropping ACID.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Concurrency Control II
Cs4432concurrency control1 CS4432: Database Systems II Lecture #23 Concurrency Control Professor Elke A. Rundensteiner.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control: Locking-based Protocols Professor Elke A. Rundensteiner.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
CSIS 7102 Spring 2004 Lecture 5 : Non-locking based concurrency control (and some more lock-based ones, too) Dr. King-Ip Lin.
V. Megalooikonomou Concurrency Control – Deadlocks (based on slides by C. Faloutsos at CMU and on notes by Silberchatz,Korth, and Sudarshan) Temple University.
Fakultas Ilmu Komputer UI 1 Exercise A series of actions to be taken on the database such that either all actions are completed successfully, or none of.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
Quick Review of Apr 29 material
ICS 421 Spring 2010 Transactions & Concurrency Control (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Concurrency Control and Recovery In real life: users access the database concurrently, and systems crash. Concurrent access to the database also improves.
1 Concurrency Control and Recovery Module 6, Lecture 1.
Transaction Management
All of ERD (Ch 3) plus: – Class/subclass relationships – Inheritance – Specialization – Generalization – Category.
1 IT420: Database Management and Organization Transactions 31 March 2006 Adina Crăiniceanu
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science Database Applications Concurrency Control, II (R&G ch. 17)
1 Transaction Management Overview Chapter Transactions  A transaction is the DBMS’s abstract view of a user program: a sequence of reads and writes.
Transaction processing Book, chapter 6.6. Problem: With a single user…. you run a query, you get the results, you run the next, etc. But database life.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications C. Faloutsos – A. Pavlo Lecture#21: Concurrency Control (R&G ch. 17)
V. Megalooikonomou Concurrency control (based on slides by C. Faloutsos at CMU and on notes by Silberchatz,Korth, and Sudarshan) Temple University – CIS.
Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos Concurrency control.
Transactions CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Concurrency Control Concurrency Control By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
1 Transactions Chapter Transactions A transaction is: a logical unit of work a sequence of steps to accomplish a single task Can have multiple.
1 Concurrency Control II: Locking and Isolation Levels.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos Recovery.
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Concurrency Control Introduction Lock-Based Protocols
Switch off your Mobiles Phones or Change Profile to Silent Mode.
Academic Year 2014 Spring Academic Year 2014 Spring.
DBMS Deadlock.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
SQLintersection Locks, Blocks, and Deadlocks Oh My! Randy Knight Wednesday, 2:15-3:15.
CS 440 Database Management Systems
Transaction Management
CS 245: Database System Principles Notes 10: More TP
Transaction Management and Concurrency Control
Concurrency Control.
Part- A Transaction Management
Transaction Management
Temple University – CIS Dept. CIS661 – Principles of Data Management
Transaction Properties
Transaction Management Overview
Transaction Management
Chapter 10 Transaction Management and Concurrency Control
Lecture#21: Concurrency Control – Part 1
Concurrency Control Chapter 17
Chapter 15 : Concurrency Control
Concurrency Unit 4.2 Dr Gordon Russell, Napier University
Transaction Management
Temple University – CIS Dept. CIS661 – Principles of Data Management
C. Faloutsos Transactions
Temple University – CIS Dept. CIS616– Principles of Data Management
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
Concurrency Unit 4.2 Dr Gordon Russell, Napier University
Database Systems (資料庫系統)
Lecture 18: Concurrency Control
Temple University – CIS Dept. CIS661 – Principles of Data Management
Presentation transcript:

C. Faloutsos Concurrency control - deadlocks Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications C. Faloutsos Concurrency control - deadlocks

General Overview Relational model - SQL Functional Dependencies & Normalization Physical Design &Indexing Query optimization Transaction processing concurrency control recovery 15-415 - C. Faloutsos

Transactions - dfn = unit of work, eg. Atomicity (all or none) move $10 from savings to checking Atomicity (all or none) Consistency Isolation (as if alone) Durability recovery concurrency control 15-415 - C. Faloutsos

Isolation - concurrency control serializability <-> correctness precedence graph automatically correct interleavings: locks + protocol (2PL, 2PLC) but: deadlocks! 15-415 - C. Faloutsos

Deadlocks detection handling (prevention) 15-415 - C. Faloutsos

Deadlock detection T1 T2 lock manager L(A) Yes L(B) Yes ... L(B) No time T1 T2 lock manager L(A) Yes L(B) Yes ... L(B) No <waits> L(A) No DEADLOCK 15-415 - C. Faloutsos

Algo for deadlock detection? 15-415 - C. Faloutsos

Algo for deadlock detection? wait-for graph: nodes -> transactions arcs -> Tsource waits for Tsink if cycle, then deadlock! 15-415 - C. Faloutsos

Eg: time for ‘B’ T1 T2 ‘A’ ‘B’ for ‘A’ T1 T2 lock manager L(A) Yes L(B) Yes ... L(B) No <waits> L(A) No for ‘B’ T1 T2 ‘A’ ‘B’ for ‘A’ 15-415 - C. Faloutsos

Another example is there a deadlock? if yes, which xacts are involved? 15-415 - C. Faloutsos

Another example now, is there a deadlock? if yes, which xacts are involved? T1 T2 T3 T4 15-415 - C. Faloutsos

Deadlock detection how often should we run the algo? how many transactions are typically involved? 15-415 - C. Faloutsos

Deadlock handling Q: what to do? T1 T2 T3 T4 15-415 - C. Faloutsos

Deadlock handling Q0: what to do? A: select a ‘victim’ & ‘rollback’ Q1: which/how to choose? T1 T2 T3 T4 15-415 - C. Faloutsos

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? T1 T2 T3 T4 15-415 - C. Faloutsos

Deadlock handling Q2: How far to rollback? A2.1: completely A2.2: minimally Q3: Starvation?? T1 T2 T3 T4 15-415 - C. Faloutsos

Deadlock handling Q3: Starvation?? A3.1: include #rollbacks in victim selection criterion. T1 T2 T3 T4 15-415 - C. Faloutsos

SQL statement usually, conc. control is transparent to the user, but LOCK <table-name> [EXCLUSIVE|SHARED] 15-415 - C. Faloutsos

Concurrency control - conclusions serializability <-> correctness automatically correct interleavings: locks + protocol (2PL, 2PLC, ...) deadlock detection + handling 15-415 - C. Faloutsos

Quiz: is there a serial schedule (= interleaving) that is not serializable? is there a serializable schedule that is not serial? can 2PL produce a non-serializable schedule? (assume no deadlocks) 15-415 - C. Faloutsos

Quiz - cont’d is there a serializable schedule that can not be produced by 2PL? a xact obeys 2PL - can it be involved in a non-serializable schedule? all xacts obey 2PL - can they end up in a deadlock? 15-415 - C. Faloutsos

serializable schedules serializable schedules Quiz - hints: Q: 2PLC?? serializable schedules serializable schedules 2PL schedules serial sch’s 15-415 - C. Faloutsos

serializable schedules serializable schedules Quiz - hints: 2PL schedules serializable schedules serializable schedules 2PLC serial sch’s 15-415 - C. Faloutsos