Homework 8. Revision : 2015/04/14 08:13



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

Concurrency Control. Module 6, Lectures 1 and 2

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

Lecture 7: Concurrency control. Rasmus Pagh

Transaction Management Overview

Database Tuning and Physical Design: Execution of Transactions

Concurrency control. Concurrency problems. Database Management System

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

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

Concurrency Control: Locking, Optimistic, Degrees of Consistency

CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013

Transactional properties of DBS

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


Database Sample Examination

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

CS 245 Final Exam Winter 2013

CMSC724: Concurrency

Part I: Entity Relationship Diagrams and SQL (40/100 Pt.)

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

Distributed Databases

1 Choosing the right data mining techniques for the job (8 minutes,

Applying Attribute Level Locking to Decrease the Deadlock on Distributed Database

Introduction to Database Systems CS4320. Instructor: Christoph Koch CS

Proposed course outline for: ICB Business Management 1

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

THE UNIVERSITY OF TRINIDAD & TOBAGO

DATA STRUCTURES USING C

SUBQUERIES AND VIEWS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6

Textbook and References

CSE331: Introduction to Networks and Security. Lecture 8 Fall 2006

Database Concurrency Control and Recovery. Simple database model

CS 2302 Data Structures Spring 2015

1 Solving LPs: The Simplex Algorithm of George Dantzig

CS 2112 Spring Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

INFO/CS 4302 Web Information Systems. FT 2012 Week 1: Course Introduction

University of Pune Revised Structure for the B. Sc. (Computer Science) Course (Second Year to be implemented from Academic Year )

CS 525 Advanced Database Organization - Spring 2013 Mon + Wed 3:15-4:30 PM, Room: Wishnick Hall 113

CHAPTER 6: DISTRIBUTED FILE SYSTEMS

Transactions. SET08104 Database Systems. Napier University

48 contact hours using STANDARD version of Study & Solutions Kit

CSE 326: Data Structures B-Trees and B+ Trees

CS 1301 Homework 6 Scribbler Line Sensing Due: Friday March 13th, before 11:55pm PM EST. Out of 130 points Files to submit:

Vector storage and access; algorithms in GIS. This is lecture 6

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

COURSE OUTLINE OF RECORD

Chapter 7: Deadlocks!

Normalization. Reduces the liklihood of anomolies

Course Content Concepts

High-Performance Concurrency Control Mechanisms for Main-Memory Databases

Distributed Transactions

b. Examine the following histories. Draw their serialization graph and identify which of them is serializable given reasons.

The Basics of Graphical Models

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

A Quick Guide to Constructing an SPSS Code Book Prepared by Amina Jabbar, Centre for Research on Inner City Health

48 contact hours using STANDARD version of Study & Solutions Kit

Parameter Fields and Prompts. chapter

CSE 562 Database Systems

Distributed Database Management Systems

Introduction to Database Management Systems

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

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

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus sandhaus@cs.nyu.edu evan@nytimes.com

Lecture 18: Reliable Storage

LMS User Manual LMS Grade Book NUST LMS

Row Echelon Form and Reduced Row Echelon Form

! Volatile storage: ! Nonvolatile storage:

Parallelization: Binary Tree Traversal

Useful Number Systems

Applicants: How to apply for a Commonwealth PhD Scholarship

Turn editing on and under Add an Activity use the drop down list and click on Questionnaire.

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

V30 Software Update Instruction. 2.3 Software upgrading

Computer and Network Security

Managing the Schedule of Classes

Using the System ORDER YOUR BELL EXPRESSVU PROGRAMMING. Page 3-1

Information Technology Services will be updating the mark sense test scoring hardware and software on Monday, May 18, We will continue to score

Last Class Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

Files. Files. Files. Files. Files. File Organisation. What s it all about? What s in a file?

PostgreSQL Concurrency Issues

Financial Management FIN 300, Sections 004, 005 Fall 2011 University of Michigan, Ross School of Business

HMIS Client Services User Guide

Recovery System C H A P T E R16. Practice Exercises

Dynamic Programming. Lecture Overview Introduction

Configuration Manager

Creating and grading assignments

Consistency Management for Multiple Perspective Software Development

LANGARA COLLEGE Course Outline

Syllabus for Course : Database Systems Engineering at Kinneret College

Fundamentals of Computer Programming CS 101 (3 Units)

Lecture 4. Parallel Programming II. Homework & Reading. Page 1. Projects handout On Friday Form teams, groups of two

Data Structures Fibonacci Heaps, Amortized Analysis

Chapter 15: Recovery System

Transcription:

Carnegie Mellon University Department of Computer Science 15-415/615- Database Applications C. Faloutsos & A. Pavlo, Spring 2015 Prepared by Hong Bin Shim DUE DATE: Thu, 4/23/2015, 1:30pm Homework 8 IMPORTANT Deposit hard copy of your answers in class at 1:30pm on Thu, 4/23/2015. Separate answers, as usually, i.e., please each question on a separate page, with the usual info (andrewid, etc) Reminders Plagiarism: Homework may be discussed with other students, but all homework is to be completed individually. Typeset all of your answers whenever possible. Illegible handwriting may get no points, at the discretion of the graders. Late homeworks: please email late homeworks to all TAs with the subject line exactly 15-415 Homework Submission (HW 8) and the count of slip-days you are using. For your information: Graded out of 100 points; 4 questions total Rough time estimate: 4 hours ( 1 hour for each question) Revision : 2015/04/14 08:13 Question Points Score Serializability and 2PL 20 Deadlock Detection and Prevention 30 Hierarchical Locking - Oscar Nominations 30 B+ tree Locking 20 Total: 100 1

15-415/615 Homework 8, Page 2 of 6 Thu, 4/23/2015, 1:30pm Question 1: Serializability and 2PL.................. [20 points] (a) Yes/No questions: i. [2 points] Conflict Serializability always permits as many schedules as View Serializability does. ii. [2 points] A schedule is conflict serializable if its dependency graph is acyclic. iii. [2 points] In the Shrinking phase of 2PL, the transaction can be granted lock requests. iv. [2 points] All serializable schedules are allowed by 2PL. v. [2 points] Schedules under strict 2PL could have cascading aborts. (b) Serializability: Consider the schedule given below in Table 1. R( ) and W( ) stand for Read and Write, respectively. time t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t 10 t 11 T 1 R(A) W(A) R(C) W(C) T 2 R(B) W(B) T 3 R(A) W(A) R(B) W(B) R(C) W(C) Table 1: A schedule with 3 transactions i. [1 point] Is this schedule serial? ii. [3 points] Give the dependency graph of this schedule. iii. [1 point] Is this schedule conflict serializable? iv. [3 points] If you answer yes to (iii), provide the equivalent serial schedule. If you answer no, briefly explain why. v. [2 points] Could this schedule have been produced by 2PL? Homework 8 continues...

15-415/615 Homework 8, Page 3 of 6 Thu, 4/23/2015, 1:30pm Question 2: Deadlock Detection and Prevention..... [30 points] (a) Deadlock Detection: Consider the following lock requests in Table 2. And note that S( ) and X( ) stand for shared lock and exclusive lock, respectively. T 1, T 2, and T 3 represent three transactions. LM stands for lock manager. time t 1 t 2 t 3 t 4 t 5 t 6 t 7 T 1 S(D) S(A) X(C) S(B) T 2 S(A) X(D) T 3 S(C) LM g Table 2: Lock requests of 3 transactions i. [6 points] For the lock requests in Table 2, determine which lock will be granted or blocked by the lock manager. Please write g in the LM row to indicate the lock is granted and b to indicate the lock is blocked. For example, in the table, the first lock (S(D) at time t 1 ) is marked as granted. ii. [4 points] Give the wait-for graph for the lock requests in Table 2. iii. [3 points] Determine whether there exists a deadlock in the lock requests in Table 2, and briefly explain why. (b) Deadlock Prevention: Consider the following lock requests in Table 3. Again, S( ) and X( ) stand for shared lock and exclusive lock, respectively. T 1, T 2, T 3, and T 4 represent four transactions. LM represents a lock manager. time t 1 t 2 t 3 t 4 t 5 t 6 T 1 S(D) S(B) T 2 S(C) X(D) T 3 X(B) T 4 X(C) LM g Table 3: Lock requests of 4 transactions Question 2 continues...

15-415/615 Homework 8, Page 4 of 6 Thu, 4/23/2015, 1:30pm i. [6 points] For the lock requests in Table 3, determine which lock request will be granted, blocked or aborted by the lock manager (LM), if it has no deadlock prevention policy. Please write g for grant, b for block and a for abort. Again, example is given in the first column. ii. [5 points] Give the wait-for graph for the lock requests in Table 3. Determine whether there exists a deadlock in the lock requests in Table 3 under LM, and briefly explain why. iii. [3 points] To prevent deadlock, we use the lock manager (LM) that adopts the Wait-Die policy. We assume that in terms of priority: T 1 > T 2 > T 3 > T 4. Determine which lock request will be granted ( g ), blocked ( b ) or aborted ( a ). Follow the same format as the previous question. iv. [3 points] Now we use the lock manager (LM) that adopts the Wound-Wait policy. We assume that in terms of priority: T 1 > T 2 > T 3 > T 4. Determine which lock request will be granted ( g ), blocked ( b ) or aborted ( a ). Follow the same format as the previous question. Homework 8 continues...

15-415/615 Homework 8, Page 5 of 6 Thu, 4/23/2015, 1:30pm Question 3: Hierarchical Locking - Oscar Nominations[30 points] Consider a Database (D) consisting of two tables, Actors (A) and Nominations (N). Specifically, Actors(aid, first name, last name), spans 300 pages, namely A 1 to A 300 Nominations(nid, aid, year, movie, character, won), spans 600 pages, namely N 1 to N 600 Further, each page contains 100 records, and we use the notation A 3 : 20 to represent the 20 th record on the third page of the Actors table. Similarly, N 5 : 10 represents the 10 th record on the fifth page of the Nominations table. We use Multiple-granularity locking, with S, X, IS, IX and SIX locks, and four levels of granularity: (1) database-level (D), (2) table-level (A, N), (3) page-level (A 1 A 300, N 1 N 600 ), (4) record-level (A 1 : 1 A 300 : 100, N 1 : 1 N 600 : 100). For each of the following operations on the database, please determine the sequence of lock requests that should be generated by a transaction that want to carry out these operations efficiently. Please follow the format of the examples listed bellow: write IS(D) for a request of database-level IS lock write X(N 2 : 30) for a request of record-level X lock for the 30 th record on the second page of the Nominations table write S(N 2 : 30 N 3 : 100) for a request of record-level S lock from the 30 th record on the second page of the Nominations table to the 100 th record on the third page of the Nominations table. (a) [6 points] Read 100 th record on page A 1. (b) [6 points] Read ALL records on page A 1 through A 15, and modify the records A 10 : 10 through A 10 : 100. (c) [6 points] Modify the first record on EACH and EVERY page of the Nominations table (these are blind writes that do not depend on the original contents in the pages). (d) [6 points] For EACH record in the Actors table, capitalize the English letters in the last name if it is not capitalized. That is, Redmayne will be modified as REDMAYNE but MOORE will be left unchanged. (e) [6 points] Delete ALL the records from ALL tables. Homework 8 continues...

15-415/615 Homework 8, Page 6 of 6 Thu, 4/23/2015, 1:30pm Question 4: B+ tree Locking........................ [20 points] Consider the following B+ tree: Figure 1: B+ tree locking To lock this B+ tree, we would like to use the Bayer-Schkolnick algorithm (described in lecture notes #22 1, slide 32-35). Important: we use the version as presented in the lecture, which does not use lock upgrade. For each of the following transactions, give the sequence of lock/unlock requests. For example, please write S(A) for a request of shared lock on node A, X(B) for a request of exclusive lock on node B and U(C) for a request of unlock node C. Important notes: Each of the following transactions is applied on the original tree, i.e., please ignore any change to the tree from earlier problems. For simplicity, ignore the changes on the pointers between leaves. (a) [5 points] Search for data entry 37* (b) [5 points] Delete data entry 7* (c) [5 points] Insert data entry 30* (d) [5 points] Insert data entry 47* 1 http://www.cs.cmu.edu/~christos/courses/dbms.s15/slides/22cc2.pdf End of Homework 8