In This Lecture. More Concurrency. Deadlocks. Precedence/Wait-For Graphs. Example. Example



Similar documents
Transactions and Recovery. Database Systems Lecture 15 Natasha Alechina

Concurrency control. Concurrency problems. Database Management System

AN STUDY ON DATA CONSISTENCY IN SPATIAL DATABASE SYSTEM

Modern Databases. Database Systems Lecture 18 Natasha Alechina

Course Content. Transactions and Concurrency Control. Objectives of Lecture 4 Transactions and Concurrency Control

Concurrency Control. Chapter 17. Comp 521 Files and Databases Fall

Normalisation to 3NF. Database Systems Lecture 11 Natasha Alechina

Distributed Database Management Systems

High-Performance Concurrency Control Mechanisms for Main-Memory Databases

Distributed Databases

Lecture 7: Concurrency control. Rasmus Pagh

Transactions. SET08104 Database Systems. Napier University

In This Lecture. Physical Design. RAID Arrays. RAID Level 0. RAID Level 1. Physical DB Issues, Indexes, Query Optimisation. Physical DB Issues

Concurrency Control. Module 6, Lectures 1 and 2

Database Management System Prof. D. Janakiram Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Comp 5311 Database Management Systems. 16. Review 2 (Physical Level)

In This Lecture. Security and Integrity. Database Security. DBMS Security Support. Privileges in SQL. Permissions and Privilege.

Simulations of the implementation of primary copy two-phase locking in distributed database systems

Database Concurrency Control and Recovery. Simple database model

Transactional properties of DBS

Chapter 7: Deadlocks!

(Pessimistic) Timestamp Ordering. Rules for read and write Operations. Pessimistic Timestamp Ordering. Write Operations and Timestamps

Guerrilla Warfare? Guerrilla Tactics - Performance Testing MS SQL Server Applications

Transactions: Definition. Transactional properties of DBS. Transactions: Management in DBS. Transactions: Read/Write Model

Using Oracle Real Application Clusters (RAC)

PostgreSQL Concurrency Issues

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I)

Concepts of Concurrent Computation

Concurrency Control: Locking, Optimistic, Degrees of Consistency

City University of Hong Kong. Information on a Course offered by Department of Computer Science with effect from Semester A in 2014 / 2015

Distributed Versioning: Consistent Replication for Scaling Back end Databases of Dynamic Content Web Sites

System model. Section 7.1. Operating Systems: Deadlock p. 1/15

Distributed Transactions

Database Tuning and Physical Design: Execution of Transactions

Using DataDirect Connect for JDBC with Oracle Real Application Clusters (RAC)

Introduction to Database Management Systems

Database Replication with MySQL and PostgreSQL

SQL and Java. Database Systems Lecture 19 Natasha Alechina

Failover Support. DataDirect Connect for ODBC Drivers. Introduction. Connection Failover

Textbook and References

Transactions and the Internet

Goals. Managing Multi-User Databases. Database Administration. DBA Tasks. (Kroenke, Chapter 9) Database Administration. Concurrency Control

Introduction to Distributed Systems

Recovery and the ACID properties CMPUT 391: Implementing Durability Recovery Manager Atomicity Durability

Introduction to Database Systems. Module 1, Lecture 1. Instructor: Raghu Ramakrishnan UW-Madison

Monitoring and Diagnosing Production Applications Using Oracle Application Diagnostics for Java. An Oracle White Paper December 2007

Increasing Driver Performance

Module 3 (14 hrs) Transactions : Transaction Processing Systems(TPS): Properties (or ACID properties) of Transactions Atomicity Consistency

In this Lecture SQL SELECT. Example Tables. SQL SELECT Overview. WHERE Clauses. DISTINCT and ALL SQL SELECT. For more information

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

Greetings! Welcome to Community Psychology! accelerated online semester Fall 2015 Sept. 1 Nov. 7, 2015

Distributed Architectures. Distributed Databases. Distributed Databases. Distributed Databases

Logistics. Database Management Systems. Chapter 1. Project. Goals for This Course. Any Questions So Far? What This Course Cannot Do.

Transactions and Concurrency Control. Goals. Database Administration. (Manga Guide to DB, Chapter 5, pg , ) Database Administration

CHAPTER 6: DISTRIBUTED FILE SYSTEMS

Roadmap DB Sys. Design & Impl. Detailed Roadmap. Paper. Transactions - dfn. Reminders: Locking and Consistency

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Chapter 10. Backup and Recovery

Transaction Management Overview

Efficient database auditing

Optimizing Concurrent Processing of Write-then-Read Transactions

Connectivity. Alliance Access 7.0. Database Recovery. Information Paper

Synchronization in. Distributed Systems. Cooperation and Coordination in. Distributed Systems. Kinds of Synchronization.

Database Application Developer Tools Using Static Analysis and Dynamic Profiling

Introduction to Database Systems CS4320. Instructor: Christoph Koch CS

Data Recovery and High Availability Guide and Reference

Distributed Database Systems

Distributed Databases. Concepts. Why distributed databases? Distributed Databases Basic Concepts

Distributed Systems [Fall 2012]

MapGuide Open Source Repository Management Back up, restore, and recover your resource repository.

Topics. Producing Production Quality Software. Concurrent Environments. Why Use Concurrency? Models of concurrency Concurrency in Java

Distributed Data Management

ETL Overview. Extract, Transform, Load (ETL) Refreshment Workflow. The ETL Process. General ETL issues. MS Integration Services

OPERATING SYSTEMS DEADLOCKS

OS OBJECTIVE QUESTIONS

ZooKeeper. Table of contents

Recovery algorithms are techniques to ensure transaction atomicity and durability despite failures. Two main approaches in recovery process

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

Training Course SQL Server 2008 Implementation and Maintenance

Unit 12 Database Recovery

Objectives. Distributed Databases and Client/Server Architecture. Distributed Database. Data Fragmentation

Management Information System Prof. Biswajit Mahanty Department of Industrial Engineering & Management Indian Institute of Technology, Kharagpur

Deadlock Detection and Recovery!

Week 1 Part 1: An Introduction to Database Systems. Databases and DBMSs. Why Use a DBMS? Why Study Databases??

Whitepaper: performance of SqlBulkCopy

Databases. DSIC. Academic Year

Monitoring applications in multitier environment. Uroš Majcen A New View on Application Management.

Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Activity Start Time Length

Concurrency control in distributed caching

Linux Scheduler. Linux Scheduler

Load Testing and Monitoring Web Applications in a Windows Environment

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Transcription:

In This Lecture More Concurrency Database Systems Lecture 17 Natasha Alechina Deadlock detection Deadlock prevention Timestamping For more information Connolly and Begg chapter 0 Deadlocks Precedence/ait-For Graphs A deadlock is an impasse that may result when two or more transactions are waiting for locks to be released which are held by each other. For example: has a lock on and is waiting for a lock on, and has a lock on and is waiting for a lock on. Given a schedule, we can detect deadlocks which will happen in this schedule using a wait-for graph (FG). Each transaction is a vertex Arcs from to if reads before writes writes before reads writes before writes ait-for Graph Each transaction is a vertex Arcs from to if read-locks then tries to write-lock it write-locks then tries to read-lock it write-locks then tries to write-lock it rite() Read() ait for graph rite() Read() ait for graph 1

rite() Read() ait for graph rite() Read() ait for graph read-locks() read-locks() rite() write-lock() tries read-lock() Read() ait for graph read-locks() read-locks() rite() write-lock() tries read-lock() Read() read-lock() write-lock() read-lock() tries read-lock() ait for graph read-locks() read-locks() rite() write-lock() tries read-lock() Read() read-lock() write-lock() read-lock() tries read-lock() tries write-lock() ait for graph Deadlock Prevention Deadlocks can arise with PL Deadlock is less of a problem than an inconsistent DB e can detect and recover from deadlock It would be nice to avoid it altogether Conservative PL All locks must be acquired before the transaction starts Hard to predict what locks are needed Low lock utilisation - transactions can hold on to locks for a long time, but not use them much

Deadlock Prevention of resource ordering e impose an ordering on the resources Transactions must acquire locks in this order Transactions can be ordered on the last resource they locked This prevents deadlock If is waiting for a resource from then that resource must come after all of s current locks All the arcs in the wait-for graph point forwards - no cycles Suppose resource order is: < This means, if you need locks on and, you first acquire a lock on and only after that a lock on (even if you want to write to before doing anything to ) It is impossible to end up in a situation when is waiting for a lock on held by, and is waiting for a lock on held by. Timestamping Timestamping Transactions can be run concurrently using a variety of techniques e looked at using locks to prevent interference An alternative is timestamping Requires less overhead in terms of tracking locks or detecting deadlock Determines the order of transactions before they are executed Each transaction has a timestamp, TS, and if starts before then TS() < TS() Can use the system clock or an incrementing counter to generate timestamps Each resource has two timestamps R(), the largest timestamp of any transaction that has read (), the largest timestamp of any transaction that has written Timestamp Protocol Timestamping If T tries to read If TS(T) < () T is rolled back and restarted with a later timestamp If TS(T) () then the read succeeds and we set R() to be max(r(), TS(T)) T tries to write If TS(T) < () or TS(T) < R() then T is rolled back and restarted with a later timestamp Otherwise the write succeeds and we set () to TS(T) Given and we will assume The transactions make alternate operations Timestamps are allocated from a counter starting at 1 goes first 3

R TS R 1 TS 1 R R 1 4

R 3 R 3 3 5

R 3 3 R 3 3 3 Timestamping Next Lecture The protocol means that transactions with higher times take precedence Equivalent to running transactions in order of their final time values Transactions don t wait - no deadlock Problems Long transactions might keep getting restarted by new transactions - starvation Rolls back old transactions, which may have done a lot of work After the break: Java and SQL (not in the exam, just for information) Feedback on coursework 5 (normalisation) Exam revision 6