CS FundamentalsVery hardGATE CS (PYQ pattern)
In a wait-for graph over transactions T1..T7 the edges (Ti waits for Tj) are T1→T2, T2→T3, T3→T1, T3→T4, T4→T5, T5→T4, T6→T3, T2→T7, T7→T6. What is the minimum number of transactions that must be aborted to break every deadlock?
- A. 3
- B. 1
- C. 4
- D. 2
Correct answer: D. 2
Cycles: T1→T2→T3→T1; T4→T5→T4; and T2→T7→T6→T3→T1→T2. Aborting T3 breaks the first and third cycles (all pass through T3) but not T4–T5, which needs a second victim: 2 in total.
More DBMS and SQL questions
- Under strict two-phase locking (shared locks for reads, exclusive for writes, all locks held until commit; a transaction whose lock…
- A B+ tree has leaf nodes holding at most 3 keys. Keys are inserted in the order 50, 20, 80, 10, 30, 60, 90, 70, 40, 25, 35, 5, 65, 75, 95…
- A query joins 5 relations R1..R5 and the optimiser considers every possible join tree, including bushy trees, with every distinct…
- R occupies 1000 pages with 100 tuples per page. S has a B+ tree index on the join attribute (3 levels, so 3 page reads to reach a leaf…
- A table has 100,000 rows in 2500 pages, and a predicate selects 3% of the rows, which are spread uniformly at random over the pages. An…
- A heap file stores 1,000,000 fixed-length records of 150 bytes in 8192-byte blocks with no block header; records do not span blocks. How…