Tree Locking Protocol Silberchatz and Kedem, JACM, January1980.

Slides:



Advertisements
Similar presentations
Universität Karlsruhe (TH) TAV 10© 2007 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. Böhm Chapter 10 Distributed Transactions: Synchronization.
Advertisements

Shortest Vector In A Lattice is NP-Hard to approximate
Cs4432concurrency control1 CS4432: Database Systems II Lecture #21 Concurrency Control : Theory Professor Elke A. Rundensteiner.
Unit 9 Concurrency Control. 9-2 Wei-Pang Yang, Information Management, NDHU Content  9.1 Introduction  9.2 Locking Technique  9.3 Optimistic Concurrency.
Database System Principles 18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control Professor Elke A. Rundensteiner.
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
Concurrency Control Part 2 R&G - Chapter 17 The sequel was far better than the original! -- Nobody.
Bayesian Networks, Winter Yoav Haimovitch & Ariel Raviv 1.
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
Graphs III (Trees, MSTs) (Chp 11.5, 11.6)
More Graphs COL 106 Slides from Naveen. Some Terminology for Graph Search A vertex is white if it is undiscovered A vertex is gray if it has been discovered.
Representing Relations Using Matrices
Tirgul 8 Graph algorithms: Strongly connected components.
Applied Discrete Mathematics Week 11: Graphs
Combinatorial Algorithms
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Yangjun Chen 1 Bipartite Graphs What is a bipartite graph? Properties of bipartite graphs Matching and maximum matching - alternative paths - augmenting.
Concurrent Transactions Even when there is no “failure,” several transactions can interact to turn a consistent state into an inconsistent state.
Wolfgang Miller / / 1 Concurrency Controll Algorithms Concurrency Control Algorithms Chapter 4.
CONCURRENCY CONTROL SECTION 18.7 THE TREE PROTOCOL By : Saloni Tamotia (215)
Granularity of Locks and Degrees of Consistency in a Shared Data Base John LaFontaine Haixuan Sun.
1 Data Structures DFS, Topological Sort Dana Shapira.
Yangjun Chen 1 Bipartite Graph 1.A graph G is bipartite if the node set V can be partitioned into two sets V 1 and V 2 in such a way that no nodes from.
Concurrency. Busy, busy, busy... In production environments, it is unlikely that we can limit our system to just one user at a time. – Consequently, it.
Transaction Processing: Concurrency and Serializability 10/4/05.
CS5371 Theory of Computation Lecture 1: Mathematics Review I (Basic Terminology)
Transactions. Definitions Transaction (program): A series of Read/Write operations on items in a Database. Example: Transaction 1 Read(C) Read(A) Write(A)
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
Presentation Topic 18.7 of Book Tree Protocol Submitted to: Prof. Dr. T.Y.LIN Submitted By :Saurabh Vishal.
CS Dept, City Univ.1 The Complexity of Connectivity in Wireless Networks Presented by LUO Hongbo.
18.7 The Tree Protocol Andy Yang. Outline Introduction Motivation Rules for Access to Tree-Structured Data Why the Tree Protocol Works.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Assignment 3 -- Solution 1. Problem 1 H 1 : r 1 [y] r 1 [x] r 2 [x] w 1 [y] c 1 w 2 [y] c 2 H 1 is normally-strict two-phase locked: rl 1 [y] r 1 [y]
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
5.2 Trees  A tree is a connected graph without any cycles.
Chapter 5: Permutation Groups  Definitions and Notations  Cycle Notation  Properties of Permutations.
Defining Liveness by Bowen Alpern and Fred B. Schneider Presented by Joe Melnyk.
 2004 SDU Lectrue4-Properties of DFS Properties of DFS Classification of edges Topological sort.
******************************************************************** *These notes contain NDSU confidential and proprietary material. * *Patents are pending.
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
Properties and Applications of Depth-First Search Trees and Forests
Data Structures Lakshmish Ramaswamy. Tree Hierarchical data structure Several real-world systems have hierarchical concepts –Physical and biological systems.
Lecture 9- Concurrency Control (continued) Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
Jinze Liu. ACID Atomicity: TX’s are either completely done or not done at all Consistency: TX’s should leave the database in a consistent state Isolation:
COMPSCI 102 Introduction to Discrete Mathematics.
 2004 SDU Lecture8 NON-Context-free languages.  2004 SDU 2 Are all languages context free? Ans: No. # of PDAs on  < # of languages on  Pumping lemma:
6/18/2016Transactional Information Systems3-1 Part II: Concurrency Control 3 Concurrency Control: Notions of Correctness for the Page Model 4 Concurrency.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
Trees.
Introduction to Algorithms
Non-regular languages
Computing Connected Components on Parallel Computers
Bipartite Graphs What is a bipartite graph?
Outline Introduction Background Distributed DBMS Architecture
Graph Algorithms – 2 DAGs Topological order
ICS 353: Design and Analysis of Algorithms
Advanced Algorithms Analysis and Design
Lecture 21: Concurrency & Locking
Yan Huang - CSCI5330 Database Implementation – Concurrency Control
Theorem 5.13: For vT‘, l’(v)= min{l(v), l(vk)+w(vk, v)}
Bipartite Graph 1. A graph G is bipartite if the node set V can be partitioned into two sets V1 and V2 in such a way that no nodes from the same set are.
Lecture 22: Intro to Transactions & Logging IV
Temple University – CIS Dept. CIS661 – Principles of Data Management
Existence of 3-factors in Star-free Graphs with High Connectivity
CPSC-608 Database Systems
Discrete Mathematics for Computer Science
Presentation transcript:

Tree Locking Protocol Silberchatz and Kedem, JACM, January1980

Database Operations  R i (x) – Transaction T i READS data item x.  W i (x) – Transaction T i WRITES data item x.

Database Operations - Locks  Transactions may obtain/release locks on data items.  LR i (x) – T i obtains READ LOCK on x.  LW i (x) – T i obtains WRITE LOCK on x.  U i (x) – T i releases LOCK on x.  locked i (x,R): LR i (x) issued but U i (x) not issued yet (T i has READ LOCK on x).  locked i (x,W): LW i (x) issued but U i (x) not issued yet.

Basic Rules  A transaction must hold an appropriate lock in order to issue a database operation: –R i (x)  locked i (x,R) –W i (x)  locked i (x,W)  A write lock can not coexist with locks of other transactions:

Simplification  We do not distinguish between READ and WRITE operations. READs behave as WRITEs. Both are ACCESS operations.  W and R are replaced by A.  RL and WL are replaced by L.  The rules become: –A i (x)  locked i (x)

Notation  Given an execution, we define: –FIRST(A) – First occurrence of operation of type A –LAST(A) – Last occurrence of operation of type A. – - Event B happens after event A.  For a transaction T i we define:  A(T i )={The set of data items accessed by T i }  L(T i )={The set of data items locked by T i }

Relation   T i  T j if: –  Observations: –  is irreflexive –  is anti-symmetric

Serializability- A Sufficient Condition  An execution T such that: – –  has no cycles. is serializable.  Proof: –Consider the transitive closure  * of  –  * has no cycles –W.l.o.g, let T 1,T 2, … be a possible topologic order. –The serial execution T’ = T 1 T 2 … is equivalent to T.

Tree Locking Protocol  The data items have a tree hierarchy.  There is a one-to-one correspondence between the data items and the nodes of a tree.  The protocol: – A i (x)  locked i (x) – – A transaction can not lock a data item previously unlocked by it. –

Properties of TLP:  Notation: E(T i ) denotes the first node locked by T i.  Lemma 1: L(T i ) is a connected subgraph of the tree.  Corollary: L(T i ) is a tree, rooted at E(T i ).  Proof (of lemma 1): –Assume by contradiction and there is at least one non-locked node on the path joining them.

Properties of TLP (cont’d) –W.l.o.g there is such node between LCA and x. Consider the one which is closest to x and its child (on the path) w. – –T i can not lock LCA(x,y) –T i can not lock y, a contradiction. LCA (x,y) x y

Relation   T i  T j if: –  Lemma: –  is anti-symmetric.  Proof: –Assume by contradiction that T 1  T 2, T 2  T 1. –Consider E(T 1 ) and E(T 2 ). One of them is descendent of the other. Otherwise –W.l.o.g assume E(T 2 ) is descendent of E(T 1 ). – Note that:

 is anti-symmetric  Assume T 1 locked E(T 2 ) before T 2.  T 2  T 1, then :  Let l(x) be the distance of x from E(T 1 ). Consider an x such that l(x) is minimum.  x is not E(T 1 ), otherwise E(T 1 )=E(T 2 ) contradicts our assumption. Therefore, l(x) > 0.  From TLP:  Then:  Consider the time intervals t 1, t 2 in which locked 1 (p(x)) and locked 2 (p(x)) are true.

 is anti-symmetric  t 1 and t 2 are disjoint.  L i (x) is in t i,,,therefore t 2 precedes t 1.  Implying:  But l(p(x)) < l(x), a contradiction.  Now, assume T 2 locked E(T 2 ) before T 1.  T 1  T 2, then ….

 is acyclic  Corollary: If T i  T j then:  Lemma:  has no cycles.  Proof:  Assume by contradiction that there are cycles. Choose a cycle of minimum possible length k.  Note that k > 2.  Consider all the nodes E(T i ) for T i in the cycle, there is a partial order on them implied by the tree.  Let v=E(T j ) a minimal element in this partial order.  Both E(T j-1 ) and E(T j+1 ) are v’s ancestors.

 is acyclic  Consider T j-1  T j  T j+1.  v is in L(T j-1 ), L(T j ) and L(T j+1 ).  Because of the corollary above, they locked it in the order T j-1, T j, T j+1.  Then T j-1 locked v before T j+1 : T j-1  T j+1.  T 1  T 2 … T j-1  T j+1  …  T k is a cycle of length k-1, a contradiction.

Serializability under TLP  Theorem: Any execution obeying TLP is rerializable.  Proof: Let T be any execution under TLP. –By definition: –  is acyclic, then  is acyclic. –Part 1 of the sufficient condition is satisfied by by the corollary to the anti-symmetry Lemma. –T is serializable.

Deadlock Freedom of TLP  Theorem: Any execution obeying TLP deadlock free.  Proof: Let T be any execution under TLP, and t any time during the execution. –Consider the “waits for” relation  t –If T i  t T j then, there is a data item x, for which locked j (x) and L i (x) is issued (but not granted) as of time t. –Then

Deadlock Freedom of TLP –Then T i  T j – –  t is acyclic  T is deadlock free.