Questions & Answers of Transactions and concurrency control

In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let TS(T1) and TS(T2) be the timestamps of transaction T1 and T2 respectively. Besides T1 holds a lock on the resource R, and T2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.

if TS(T2)<TS(T1)then

T1 is killed

else T2 waits.

Assume any transaction that is not killed terminates eventually.Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlock?

Two transaction T1 and T2 are given as

T1 : r1(X)w1(X)r1(Y)w1(Y)

T2 : r2(Y)w2(Y)r2(Z)w2(Z)

Where ri (V) denotes a read operation by transaction Ti on a variable V and wi(V) denotes a write operation by transaction Ti on a variable V. The total number of conflict serializable schedules that can be formed by T1 and T2 is ___________.

Which one of the following is NOT a part of the ACID properties of database transactions?

Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects{01,...,0k}. This is done in the following manner:

Step1. T acquires exclusive locks to 01, ..., 0k in increasing order of their addresses.

Step2. The required operations are performed.

Step3. All locks are released.

This protocol will

Suppose a database schedule S involves transactions $T_1,. . . , T_n$. Construct the precedence graph of S with vertices representing the transactions and edges representing the conflicts. If S is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule?

Consider the following database schedule with two transactions, T1 and T2.

                                           S = $r_2$(X); $r_1$(X); $r_2$(Y); $w_1$(X); $r_1$(Y); $w_2$(X); $a_1$; $a_2$

where $r_i$(Z) denotes a read operation by transaction Ti on a variable Z, $w_i$(Z) denotes a write operation by $T_i$ on a variable Z and $a_i$ denotes an abort by transaction $T_i$.

Which one of the following statements about the above schedule is TRUE?

Consider the following transaction involving two bank accounts x and y.
read(x); x : = x–50; write(x); read(y); y:=y+50; write(y)
The constraint that the sum of the accounts x and y should remain constant is that of

Consider a simple checkpointing protocol and the following set of operations in the log.
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);
If a crash happens now the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?

Consider the following partial Schedule S involving two transactions T1and T2. Only the read and the write operations have been shown. The read operation on data item P is denoted by read (P) and the write operation on data item P is denoted by write (P).

Time
instance

Transaction-id
T1 T2
1 read(A)  
2 write(A)  
3   read(C)
4   write(C)
5   read(B)
6   write(B)
7   read(A)
8   commit
9 read(B)  
Schedule S

Suppose that the transaction T1 fails immediately after time instance 9. Which one of the following statements is correct?

Consider the following four schedules due to three transactions (indicated by the subscript) using read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of them is conflict serializable?

Consider the following schedule S of transactions T1, T2, T3, T4:

T1 T2 T3 T4

 

 

 

 

Writes(X)
Commit

Reads(X)

 

 

 

 

Writes(Y)
Reads(Z)
Commit

 

 

Writes(X)
Commit

 

 

 

 

 

 

 

 

Reads(X)
Reads(Y)
Commit

Which one of the following statements is CORRECT?

Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.

T1: r1(X); r1(Z); w1(X); w1(Z)
T2: r2(Y); r2(Z); w2(Z)
T3: r3(Y); r3(X); w3(Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)

Which one of the following statements about the schedules is TRUE?

Consider the following transactions with data items P and Q initialized to zero:

T1 :read (P);
      read (Q);
      if P = 0 then Q := Q + 1 ;
      write (Q).

T2 : read (Q);
    read (P);
    if Q = 0 then P := P + 1 ;
    write (P).

Any non-serial interleaving of T1 and T2 for concurrent execution leads to

Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock?

I. 2-phase locking
II. Time-stamp ordering

Consider the following schedule for transactions T1, T2 and T3:

T1 T2 T3
Read (X)    
  Read (Y)  
    Read (Y)
  Write (Y)  
Write (X)    
    Write (X)
  Read (X)  
  Write (X)  

Which one of the schedules below is the correct serialization of the above?

Consider two transactions T1 and T2, and four schedules S1, S2, S3, S4 of T1 and T2 as given below:

T1 : R1 [x] W1 [x] W1 [y]
T2 : R2 [x] R2 [y] W2 [y]
S1 : R1 [x] R2 [x] R2 [y] W1 [x] W1 [y] W2 [y]
S2 : R1 [x] R2 [x] R2 [y] W1 [x] W2 [y] W1 [y]
S3 : R1 [x] W1 [x] R2 [x] W1 [y] R2 [y] W2 [y]
S4 : R2 [x] R2 [y] R1 [x] W1 [x] W1 [y] W2 [y]

Which of the above schedules are conflict-serializable?

Consider the following schedules involving two transactions. Which one of the following statements is TRUE?

S1: r1(X); r1(Y); r2(X); r2(Y); w2(Y); w1(X)
S2: r1(X); r2(X); r2(Y); w2(Y); r1(Y); w1(X)