0% found this document useful (0 votes)
21 views33 pages

Concurrency Control

The document discusses various types of schedules in database transactions, focusing on recoverability, including cascading rollbacks, cascadeless schedules, and strict schedules. It outlines important relationships between these types, such as every strict schedule being cascadeless and recoverable, while providing classroom practice questions and previous GATE exam questions for further understanding. Additionally, it introduces concepts of serializability, including conflict serializability and view serializability, with conditions for equivalence between schedules.

Uploaded by

Vivek Yadav
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)
21 views33 pages

Concurrency Control

The document discusses various types of schedules in database transactions, focusing on recoverability, including cascading rollbacks, cascadeless schedules, and strict schedules. It outlines important relationships between these types, such as every strict schedule being cascadeless and recoverable, while providing classroom practice questions and previous GATE exam questions for further understanding. Additionally, it introduces concepts of serializability, including conflict serializability and view serializability, with conditions for equivalence between schedules.

Uploaded by

Vivek Yadav
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/ 33

Schedules based on Recoverability

3. Schedule with cascading Rollback’s / Aborts:


Single transaction failure if leads to
more than one transaction to abort is said to be
a schedule with cascading rollback’s / Aborts.
Schedules based on Recoverability
4. Cascadeless Schedule:
A Cascadeless schedule is one where,
for each pair of transactions Ti and Tj such that
Tj reads a data item previously written by Ti
and the commit operation of Ti appears before
the read operation of Tj.
Schedules based on Recoverability
5. Strict Schedule:
A schedule is said to be strict, if a value
written by a transaction T is to be read or
written by other transaction only after either T
commits or aborts.
Important Points
1. Every cascadeless schedule is also recoverable but every
recoverable schedule need not be cascade less.
2. Every Strict Schedule is cascade less and every cascade less
schedule is recoverable, there fore every strict schedule is both
cascade less and recoverable.

Strict Cascadeless Recoverable


Class Room Practice Question:
Q. Which of the following statements are true? (MSQ) [ CRPQ-9]

a. All cascade less schedules are also recoverable schedules

b. All recoverable schedules are also cascade less schedules

c. All strict schedules are cascade less and recoverable

d. All cascade less and recoverable schedules are strict schedules


Class Room Practice Question:

4. Consider the following schedule.


R1(A), R2(B), W1(A), R3(A), W3(A),
Commit3, W2(B), Commit2, Abort1.
The above schedule is _______.
(a) Strict schedule
(b) Recoverable schedule
(c) Cascadeless schedule
(d) Non recoverable schedule
Class Room Practice Question:
5. Consider the schedule given
T1: R(x), T2: W(x), T1: W(x), T3: R(x), T1:
commit, T2: commit, T3: commit
If we swap operations “ T1 : commit, T3 :
commit” in the schedule then what is its
impact?
(a) Schedule becomes non recoverable
(b) Schedule becomes strict
(c) Schedule becomes cascading roll back
(d) No impact
Previous GATE Question:
Q. Consider the following schedules:
S1: R1(x) W1(x) R1(y) R2(x) W2(x) c2, c1;
S2: R2(x) W2(x) R1(y) R1(x) W2(x) c2, c1;
Which of the following is true? [GATE-07] [CRPQ-6]
(a) Both S1 and S2 are recoverable
(b) S1 is recoverable but S2 is not
(c) S2 is recoverable but S1 is not
(d) Both schedules are not recoverable
Class Room Practice Question:

7. T1: R(x), T1: R(y), T1: W(x), T2: R(y), T3:


W(y), T1: W(x), T2: R(y),
What condition holds good for Recoverability.
(a) T2 should commit before T3.
(b) T3 should commit before T2.
(c) T1 should commit before T3.
(d) T2 should commit before T1.
Class Room Practice Question:
Previous GATE Question:
Q. Consider the following database schedule with two
transactions, T1 and T2.

S = r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2

where ri(Z) denotes a read operation by transaction Ti on a


variable Z, wi(Z) denotes a write operation by Ti on a
variable Z and ai denotes an abort by transaction Ti.
Which one of the following statements about the above
schedule is TRUE? [GATE-16-Set2]

(a) S is non-recoverable
(b) S is recoverable, but has a cascading abort
(c) S does not have a cascading abort
(d) S is strict
Serializability
A Concurrent schedule that when executed, if it
is equivalent to some serial schedule is said to be a
serializable schedule.

1. Conflict Serializability:
A schedule is said to be conflict serializable if it
is conflict equivalent to some serial schedule
Two schedules S1 and S2 are said to be conflict
equivalent if and only if all the conflict operations in
both the schedules are same.
The conflict operations are operations on same
data item by the different transactions in which at
least one operation is a write operation.
Previous GATE Question:
Previous GATE Question:

GATE-2024
Previous GATE Question: GATE-2024 (DA)
Previous GATE Question:
Which one of the following statements is
Q. Consider the following schedule S of CORRECT? [GATE-14-Set2]
transactions T1, T2, T3, T4;
(a) S is conflict-serializable but not recoverable
T1 T2 T3 T4 (b) S is not conflict-serializable but is recoverable
Reads(X) (c) S is both conflict-serializable and recoverable
Writes(X) (d) S is neither conflict-serializable nor it is recoverable
Commit
Writes(X)
Commit
Writes(Y)
Reads(Z)
Commit
Reads(X)
Reads(Y)
Commit
GATE-2022 [CRPQ-12]
Class Room Practice Question:
GATE-2021-Set1
Previous GATE Question: Q. 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? [GATE-09]
(a) S1 and S2 (b) S2 and S3
(c) S3 only (d) S4 only
Previous GATE Question:

12. Consider the schedules S1 and S2 given below.

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 schedule is TRUE?


(GATE-07)

(a) Only S1 is conflict-serializable.

(b) Only S2 is conflict-serializable.

(c) Both S1 and S2 are conflict-serializable

(d) Neither S1 nor S2 is conflict-serializable.


Previous GATE Question: Q. Consider the transactions T1, T2, and T3 are 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
schedule is TRUE? [GATE-14][CRPQ-13]
(a) Only S1 is conflict-serializable.
(b) Only S2 is conflict-serializable.
(c) Both S1 and S2 are conflict-serializable
(d) Neither S1 nor S2 is conflict-serializable.
Previous GATE Question:
Let S be the following schedule of operations of three transactions T1,T2 and T3
in a relational database system:
R2(Y), R1(X), R3(Z), R1(Y), W1(X), R2(Z), W2(Y), R3(X), W3(Z)
Consider the statements P and Q below:
P: S is conflict-serializable
Q: If T3 commits before T1 finishes, then S is recoverable.
Which one of the following choices is correct? [GATE-2021]
(a) Both P and Q are false
(b) P is false and Q is true
(c) P is true and Q is false
(d) Both P and Q are true.
Previous GATE Question:
Q. Consider the following three schedules of transactions T1, T2 and T3. (Notation: In the following
NYO represents the action Y (R for read W for write) performed by transaction N on object O.)

(S1) 2RA 2WA 3RC 2WB 3WA 3WC 1RA 1RB 1WA 1WB

(S2) 3RC 2RA 2WA 2WB 3WA 1RA 1RB 1WA 1WB 3WC

(S3) 2RA 3RC 3WA 2WA 2WB 3WC 1RA 1RB 1WA 1WB

Which of the following statements is TRUE? [GATE-2008] [CRPQ-14]


(a) S1, S2 and S3 are all conflict equivalent to each other
(b) No two of S1, S2 and S3 are conflict equivalent to each other
(c) S2 is conflict equivalent to S3, but not to S1
(d) S1 is conflict equivalent to S2, but not to S3
[GATE-2020]
[ CRPQ-15 ]
Previous GATE Question:
Q. Two transactions 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 are ________.
[GATE-2017]
View Serializability
A schedule is said to be View serializable if it is
view equivalent to some serial schedule
Two schedules S1 and S2 are said to be View
equivalent if and only if the following three conditions
are satisfied for each data item.
1) Initial Read
If a transaction Ti reading the initial data item A in
schedule S1 then transaction Ti in S2 also should read
initial data item A.
2)Updated Read
If transaction Ti is reading A which is updated by
transaction Tj in S1 then in S2 also Ti should read A
which is updated by Tj.
3)Final Write operation
If a transaction Ti performs write(A) last in S1, then in
S2 also Ti should perform final write operation.
Class Room Practice Question:
Q. Consider the schedule below.
R1(A) W2(A) R3(A) W1(A) W3(A) [ CRPQ-16]
If the above schedule serializable or not? If yes, it is equivalent to which serial schedule.
Find the proper combination of the given alternatives from I to VII.
I. View serializable
II. Conflict serializable
III. Both
IV. Not serializable
V. T2 T1 T3
VI. T1 T2 T3
VII.T2 T3 T1

(a) III, VI (b) II, V


(c) I, VI (d) I, V
Class Room Practice Question:
[CRPQ-17]

You might also like