CS FundamentalsVery hardGATE CS (PYQ pattern)
Optimistic concurrency control with backward validation. Transactions (start, validation, finish times; read set; write set): T1 (0, 4, 5; {A,B}; {B}), T2 (2, 6, 9; {B,C}; {C}), T3 (3, 8, 11; {D}; {A}), T4 (7, 10, 12; {C}; {E}). Transactions are validated in validation-time order against every earlier transaction that PASSED validation; Tj passes against Ti if (1) Ti finishes before Tj starts, or (2) Ti finishes before Tj's validation and WS(Ti) ∩ RS(Tj) = ∅, or (3) WS(Ti) ∩ RS(Tj) = ∅, WS(Ti) ∩ WS(Tj) = ∅ and Ti finishes before Tj finishes. Which transactions pass?
- A. T1, T4
- B. T1, T2
- C. T1, T3, T4
- D. T1, T3
Correct answer: C. T1, T3, T4
T1 passes (nothing earlier). T2 vs T1: T1 finishes at 5 before T2's validation at 6 and WS(T1) = {B} intersects RS(T2) = {B,C}, so (2) fails; (1) fails (5 > 2) and (3) fails (WS and RS overlap), so T2 fails. T3 vs T1: finishes 5 < 8 and WS(T1) = {B} does not meet RS(T3) = {D}: passes. T4 vs T1: T1 finished before T4 started: ok; vs T3: T3 finishes at 11, after T4 starts, WS(T3) = {A} does not meet RS(T4) = {C} but (2) needs T3 to finish before T4's validation (10): no; (3) needs T3 to finish before T4 finishes (12): yes, and WS(T3) is disjoint from WS(T4): passes.
More DBMS and SQL questions
- A two-phase commit has 1 coordinator and 5 participants and uses the read-only optimisation. All 5 receive PREPARE. Three vote YES, one…
- A linear hashing file starts with 2 buckets (hash h0 = k mod 2, then h1 = k mod 4, h2 = k mod 8, ...), a bucket holds 2 keys before it…
- A B+ tree index is built on (a, b) in this order. For which of these predicates can a search descend directly to a contiguous range of…
- Which of the following relational-algebra identities are valid for union-compatible relations R and S? I. σ{A=1}(R ∪ S) = σ{A=1}(R) ∪…
- R(A, B) has 100 tuples; R.B is a foreign key to S(B), which is S's primary key, but R.B allows NULL and 10 tuples of R have B = NULL. S…
- Three transactions each run x = x + 10 as an unprotected read followed by a write of (value read + 10), on a shared x that starts at 0…