0% found this document useful (0 votes)
90 views7 pages

Transactions and Concurrency Control

The document discusses transactions and concurrency control. It includes several multiple choice questions related to transaction schedules, serialization, isolation levels, and concurrency control protocols. Specifically, it covers topics like serializable schedules, recoverability, consistency constraints, timestamp ordering, locking protocols, and isolation anomalies.

Uploaded by

bhavesh agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views7 pages

Transactions and Concurrency Control

The document discusses transactions and concurrency control. It includes several multiple choice questions related to transaction schedules, serialization, isolation levels, and concurrency control protocols. Specifically, it covers topics like serializable schedules, recoverability, consistency constraints, timestamp ordering, locking protocols, and isolation anomalies.

Uploaded by

bhavesh agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

TRANSACTIONS AND CONCURRENCY CONTROL

1. Consider three data items D1, D2 and D3 and D3 and the following execution schedule of
transactions T1, T2 and T3. In the diagram, R(D) and W(D) denotes the actions reading and
writing the data item D respectively.
T1 T2 T3
R(D3);
R(D2);
W(D2);
R(D2);
R(D3);
R(D1);
W(D1);
R(D1);
R(D2);
W(D2);
W(D1);

Which of the following statements are correct?

(a) The schedule is serializable as T2; T3; T1 (b) The schedule is serializable as T2; T1; T3
(c) The schedule is serializable as T3; T2; T1 (d) The schedule is not serializable

2. Consider the following transaction involving 2 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:

(a) Atomicity (b) Consistency


(c) Isolation (d) Durability

3. 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);

1
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3); (write, T3, z, 7, 2);

If a crash happens now and the system tries to recover using both undo and redo operation,
what are the contents of the undo list and the redo list?

(a) Undo: T3, T1, Redo: T2 (b) Undo: T3, T1; Redo: T2, T4
(c) Undo: none, Redo: T1, T2, T3, T4 (d) Undo: T3, T1, T4: Redo: T2

4. Consider the following partial schedule S involving 2 transactions T1 and T2. Only the read
and write operations have been shown. The read operation on data item P is denoted by r(P)
and write by w(P):

Transaction_id
Time
T1 T2
1 r(A)
2 w(A)
3 r(C)
4 w(C)
5 r(B)
6 w(B)
7 r(A)
8 Commit
9 r(B)

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

(a) T2 must be aborted and then both T1 and T2 must be restarted to ensure transaction
atomicity
(b) Schedule S is non-recoverable and cannot ensure transaction atomicity
(c) Only T2 must be aborted and then restarted to ensure transaction atomicity
(d) Schedule S is recoverable and can ensure atomicity and nothing else needs to be done

5. How many concurrent schedules can be formed with 3 transactions having 3, 2, 1 operations?

COMMON DATA QUESTIONS

6. Consider the following schedules:

S1: W2(x), W1(x), R3(x), R1(x), W2(y), R3(y), R3(z), R2(x)

2
S2: R3(z), W2(x), W2(y), R1(x), R3(x), R2(z), R3(y), W1(x)
S3: R2(z), W2(x), W2(y), W1(x), R1(x), R3(x), R3(z), R3(y)

Which one of the above schedules are conflict equivalent?

(a) S1, S2 (b) S1, S3


(c) S2, S3 (d) None of these

7. Which of the schedules are serializable?

(a) S1, S2 (b) S1, S3


(c) S2, S3 (d) None of these

8. Consider the following schedules:

S1: r1(A); r3(A); w1(A); r2(A); w2(B); w3(B)


S2: r1(A); w1(a); r3(A); w1(B); r2(A); w3(B); r2(B)

Which one of the following is conflict serializable?

(a) S1 (b) S2
(c) S1, S2 (d) None of these

9. Which of the following is True for schedule S?

S: r1(a), r2(b), w2(a), w2(b),w3(a), r3(c), w3(b), r1(c), w4(b), w3(c), r4(a), r4(c), w4(c); commit1,
commit2, commit3, commit4

(a) S is conflict serializable with sequence <T1 T2 T3 T4>


(b) S is view serializable but not conflict serializable
(c) S is neither conflict serializable nor view serializable
(d) S is conflict serializable with <T2 T1 T3 T4>

10. The time stamp of 2 transactions T1 and T2 are 10 and are 10 and 15 respectively. Consider
the following with T1 and T2 operations.

S: R1(x), W1(x), R2(x), W2(x); R1(y), W1(y), R2(y), W2(y)

Which of the following is true?

3
(a) S holds in Basic time stamp protocol (b) S holds under Thomas Write rule
(c) S holds under Multiversion time stamp (d) None of these

11. Consider the following log information that involves 3 transactions. Assume checkpoint is
used for crash recovery. The order of transactions are shown below:

Identify the schedule shown in the log file?

(a) Recoverable and conflict serializable


(b) Not recoverable and conflict serializable
(c) Recoverable and not conflict serializable
(d) Not recoverable and not conflict serializable

12. Fill the missing entry for the intention lock model:

Find the missing entries a, b, c in the compatibility matrix.

(a) Yes, Yes, Yes (b) Yes, No, Yes


(c) No, Yes, No (d) Yes, Yes, No

4
13. Which problem among the following is encountered in the given schedule?

T1 T2
R(A)
R(B)
B=A
W(B)
R(A)
A= A+10
W(A)
Commit
R(A)
R(C)
C=A
W(C)

14. Consider the following scenarios:

T1 T2
R(A)
R(B)
R(C)
R(A)
R(B)
P:___
Q:___
R(C)

The possible values of P and Q allowed under Thomas Write Rule but not under basic time
stamp ordering protocol if TS(T2) > TS(T1)

(a) W(B), W(C) (b) W(A), W(A)


(c) Both (A) and (B) (d) None of these

5
15. Consider the following tree and locking sequence:

I. Lock_X(A), lock_X(B), lock_X(D), unlock(D), lock_X(F), unlock(F), unlock(B),


unlock(A)
II. Lock_X(A), lock_X(E), lock_X(H), unlock(H), unlock(E), unlock(A)
III. Lock_X(B), lock_X(F), lock_X(E), unlock(F), unlock(E), unlock(B)

Which of the following is the valid locking sequence for true based protocol?

(a) II and III (b) I only


(c) I and III (d) II only

16. Consider the following schedule:

T1 T2
R(A)
A=A+10
R(B)
A=B+10
W(A)
R(B)
B=B+10
R(A)
B=A+10
W(B)
Commit
Commit

Which of the following transaction problems is present in the given schedule?

(a) Dirty Read (b) Lost update


(c) Unrepeatable read (d) Both (a) and (b)

6
17. The precedence graph of a schedule with 3 transactions T1, T2, T3 is:

The possible schedule is:

(a) r1(A); w2(A); w1(A); w3(A) (b) r1(A); w2(A); w3(A); w1(A)
(c) r1(A); w3(A); w2(A); w1(A) (d) None of these

You might also like