Docsity

Exercises and Solutions for Transaction Processing - Assignment | CSCE 520, Assignments of Computer Science

Toggle sidebar
bg1
Exercises and solutions for Transaction Processing
1. What is the ACID property of transactions?
ACID property of transactions:
Atomicity: all or none of the operations of a transaction are performed.
Consistency: the transaction does not violate and rules or constraints of the database. If
a transaction started to execute on a consistent database state, it leaves the database in a
consistent state.
Isolation: The operations that take place within a transaction are isolated from the
operations of other transactions or other database operations.
Durability: once a transaction has committed, the results of it will persist and remain
accurate and stable within the database even at the present of failures.
2. From Database Systems: The Complete Book: Page 931, for exercises 18.2.4 a, b, c, d, e
answer i and ii.
a)
i. The precedence graph is
T3 -----> T2 -----> T1
ii. The schedule is thus conflict-serializable.
b)
i. The precedence graph is
T1 T2
T3
ii. The schedule is thus conflict-serializable.
c)
i. The precedence graph is
T1 T2
T3
ii. The schedule is thus NOT conflict-serializable โ€“ it has a cycle.
pf3

Partial preview of the text

Download Exercises and Solutions for Transaction Processing - Assignment | CSCE 520 and more Assignments Computer Science in PDF only on Docsity!

Exercises and solutions for Transaction Processing

1. What is the ACID property of transactions? ACID property of transactions: Atomicity : all or none of the operations of a transaction are performed. Consistency: the transaction does not violate and rules or constraints of the database. If a transaction started to execute on a consistent database state, it leaves the database in a consistent state. Isolation: The operations that take place within a transaction are isolated from the operations of other transactions or other database operations. Durability: once a transaction has committed, the results of it will persist and remain accurate and stable within the database even at the present of failures. 2. From Database Systems: The Complete Book: Page 931, for exercises 18.2.4 a, b, c, d, e answer i and ii. a) i. The precedence graph is T3 -----> T2 -----> T ii. The schedule is thus conflict-serializable. b) i. The precedence graph is T1 T T ii. The schedule is thus conflict-serializable. c) i. The precedence graph is T1 T T ii. The schedule is thus NOT conflict-serializable โ€“ it has a cycle.

d) i. The precedence graph is T1 T ii. The schedule is thus NOT conflict-serializable โ€“ it has a cycle. e) i. The precedence graph is T3 T1 T2 T ii. The schedule is thus NOT conflict-serializable โ€“ it has a cycle.

3. Define: Legal scheduler : If a data item is locked by a transaction, then no other transaction can acquire a conflicting lock on that data item until the first transaction releases the lock. Well formed transaction : a transaction lock a data item in the appropriate lock before performing any operation on the data item, then releases the lock after the operations. Recoverable schedule : A schedule is recoverable if for every reads-from relation between transactions T1 and T2, if T1 reads-from T2 and T1 commits, then T2โ€™s commit must appear before T1โ€™s. Avoids cascading abort : A schedule Avoids cascading abort if for every reads-from relation between transactions T1 and T2, if T1 reads-from T2 then T2โ€™s commit must appear before the read operation of T1, i.e., transactions read only committed values. Strict schedule : if the transactions can read and write only committed values. 4. What is 2-phase locking? What is Strict 2-phase locking? 2-phase locking : transactions have a growing phase (all locks needed for the transaction are acquired) and a shrinking phase (locks are released). That is, the transaction cannot release any lock until all locks are obtained. Strict 2-phase : same as before, but no locks can be released until the transaction either aborts of commits.