# Recent questions tagged transaction-and-concurrency

1
When transaction $Ti$ requests a data item currently held by $Tj,Ti$ is allowed to wait only if it has a time stamp smaller than that of $Tj$ (that is $Ti$ is order than Tj). Otherwise, $Ti$ is rolled back (dies). This is Wait-die Wait-wound Wound-wait Wait
2
3
4
Give example schedules to show that if any of lookup, insert or delete do not lock the next key value, the phantom phenomenon could go undetected.
5
Explain the reason for the use of degree-two consistency. What disadvantages dos this approach have ?
6
Devise a timestamp-based protocol that avoids the phantom phenomenon.
7
Explain the phantom phenomenon. Why may this phenomenon lead to an incorrect concurrent execution despite the use of the two-phase locking protocol ?
8
Consider the timestamp ordering protocol, and two transactions, one that writes two data items p and q, and another that reads the same two data items. Give a schedule whereby the timestamp test for a write operation fails and causes the first transaction to be ... carry out actions, but are unable to complete their task because of interaction with the other processes, is called a live lock.)
9
10
Under what conditions is it less expensive to avoid deadlock than to allow deadlocks to occur and then to detect them ?
11
Explain why the following technique for transaction execution may provide better performance than just using strict two-phase locking: First execute the transaction without acquiring any locks and without performing any writes to the database as in the validation based techniques, ... the database. Instead, rerun the transaction using strict two-phase locking. (Hint: Consider waits for disk I/O.)
12
Under a modified version of the timestamp protocol, we require that a commit bit be tested to see whether a read request must wait. Explain how the commit bit can prevent cascading abort. Why is this test not necessary for write requests?
13
For each of the following protocols, describe aspects of practical applications that would lead you to suggest using the protocol, and aspects that would suggest not using the protocol: $•$ Two-phase locking $•$ Two-phase locking with multiple-granularity locking $•$ The tree protocol $•$ Timestamp ordering $•$ Validation $•$ Multi version timestamp ordering $•$ Multi version two-phase locking
14
Show that there are schedules that are possible under the two-phase locking protocol, but are not possible under the timestamp protocol, and vice versa.
15
Use of multiple-granularity locking may require more or fewer locks than an equivalent system with a single lock granularity. Provide examples of both situations, and compare the relative amount of concurrency allowed.
16
Although SIX mode is useful in multiple-granularity locking, an exclusive and intend-shared (XIS) mode is of no use. Why is it useless ?
17
In multiple-granularity locking, what is the difference between implicit and explicit locking ?
18
When a transaction is rolled back under timestamp ordering, it is assigned a new timestamp. Why can it not simply keep its old timestamp ?
19
In timestamp ordering,$W-timestamp(Q)$ denotes the largest timestamp of any transaction that executed $write(Q)$ successfully. Suppose that, instead, we defined it to be the timestamp of the most recent transaction to execute $write(Q)$ successfully.Would this change in wording make any difference ? Explain your answer.
20
Consider a database system that includes an atomic increment operation, in addition to the read and write operations. Let V be the value of data item X. The operation $increment(X)$ by C sets the value of X to V + C in an atomic step. The ... $b$. Show that the inclusion of increment mode locks allows for increased concurrency. (Hint: Consider check-clearing transactions in our bank example.)
21
Locking is not done explicitly in persistent programming languages. Rather, objects (or the corresponding pages) must be locked when the objects are accessed. Most modern operating systems allow the user to set access protections (no access, read, write) on ... ,for example). Describe how the access-protection mechanism can be used for page-level locking in a persistent programming language.
22
Consider a variant of the tree protocol called the forest protocol. The database is organized as a forest of rooted trees. Each transaction $T_i$ must follow the following rules:  The first lock in each tree may be on any data item.  The second, and all ... data item may not be relocked by Ti after it has been unlocked by $T_i$. Show that the forest protocol does not ensure serializability.
23
Consider the following graph-based locking protocol that allows only exclusive lock modes, and that operates on data graphs that are in the form of a rooted directed acyclic graph.  A transaction can lock any vertex first.  To lock any other vertex, the ... , and must be holding a lock on one of the parents of the vertex. Show that the protocol ensures serializability and deadlock freedom.
24
Consider the following graph-based locking protocol, which allows only exclusive lock modes, and which operates on data graphs that are in the form of a rooted directed acyclic graph.  A transaction can lock any vertex first.  To lock any other vertex ... must be holding a lock on the majority of the parents of that vertex. Show that the protocol ensures serializability and deadlock freedom.
25
Consider the following extension to the tree-locking protocol, which allows both shared and exclusive locks:  A transaction can be either a read-only transaction, in which case it can request only shared locks, or an update transaction, in which ... any data item first, whereas update transactions must lock the root first. Show that the protocol ensures serializability and deadlock freedom.
26
Show by example that there are schedules possible under the tree protocol that are not possible under the two-phase locking protocol, and vice versa.