GateAI
Transactions and Concurrency Control

GATE CSE 2017 Set 2 · Q44

NAT2 marksHard

Time

Two transactions T1T_1 and T2T_2 are given as T1:r1(X)w1(X)r1(Y)w1(Y)T_1: r_1(X)w_1(X)r_1(Y)w_1(Y) T2:r2(Y)w2(Y)r2(Z)w2(Z)T_2: r_2(Y)w_2(Y)r_2(Z)w_2(Z) where ri(V)r_i(V) denotes a read operation by transaction TiT_i on a variable VV and wi(V)w_i(V) denotes a write operation by transaction TiT_i on a variable VV. The total number of conflict serializable schedules that can be formed by T1T_1 and T2T_2 is ________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 54 (±0)

Transactions and Concurrency Control

Each transaction contains 44 operations, so the total number of interleaved schedules of T1T_1 and T2T_2 is:

(4+44)=(84)=70\binom{4 + 4}{4} = \binom{8}{4} = 70

Conflicting operations only occur on variable YY:

  • Operations of T1T_1 on YY: r1(Y)r_1(Y) (3rd operation of T1T_1) and w1(Y)w_1(Y) (4th operation of T1T_1).

  • Operations of T2T_2 on YY: r2(Y)r_2(Y) (1st operation of T2T_2) and w2(Y)w_2(Y) (2nd operation of T2T_2).

A schedule is conflict serializable if its precedence graph has no cycle, which means either:

  1. T1→T2T_1 \to T_2: All operations of T1T_1 on YY occur before any operation of T2T_2 on YY, i.e., w1(Y)w_1(Y) occurs before r2(Y)r_2(Y). Since w1(Y)w_1(Y) is the last operation of T1T_1 and r2(Y)r_2(Y) is the first operation of T2T_2, all 44 operations of T1T_1 must precede all 44 operations of T2T_2. There is only 11 such schedule: T1T2T_1 T_2.

  2. T2→T1T_2 \to T_1: All operations of T2T_2 on YY occur before any operation of T1T_1 on YY, i.e., w2(Y)w_2(Y) occurs before r1(Y)r_1(Y).

A schedule is not conflict serializable if and only if it produces a cycle, which happens when:

  • r1(Y)r_1(Y) appears before w2(Y)w_2(Y), and

  • r2(Y)r_2(Y) appears before w1(Y)w_1(Y).

Let us count the number of non-serializable schedules:

  • Among the 88 positions in the schedule, let T1T_1 occupy 44 positions and T2T_2 occupy the other 44.

  • The non-serializable condition means r1(Y)r_1(Y) (the 3rd op of T1T_1) appears before w2(Y)w_2(Y) (the 2nd op of T2T_2), while r2(Y)r_2(Y) (1st op of T2T_2) appears before w1(Y)w_1(Y) (4th op of T1T_1).

  • Counting the combinations of positions where this holds yields exactly 1616 non-serializable schedules.

Thus, the total number of conflict serializable schedules is:

70−16=5470 - 16 = 54

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Transactions and Concurrency Control previous year question is Q44 of the GATE CSE 2017 Set 2 paper. Find more GATE CSE PYQs on Transactions and Concurrency Control in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Transactions and Concurrency Control PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Transactions and Concurrency Control in GATE CSE

Transactions and Concurrency Control has 25 GATE CSE PYQs across 20 papers from 2012 to 2026. This is the only 2-mark NAT question among them, and it is the only one in GATE CSE 2017 Set 2.

How GATE tests Transactions and Concurrency Control

More from GATE CSE 2017 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2017 Set 2 · Q44 · NAT

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 is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.