A · Compressed recap
A transaction is one logical unit of work (reads, writes, then commit or abort). ACID: atomicity and durability by the recovery manager (undo, redo), isolation by concurrency control, consistency by the programmer. States: active → partially committed → committed; failed → aborted.
Uncontrolled interleaving gives lost updates (R1 R2 W1 W2), dirty reads (reading uncommitted data), unrepeatable reads, phantoms. SQL levels: RU < RC (no dirty) < RR (no unrepeatable) < SERIALIZABLE (no phantom). A schedule keeps each transaction's order; n! serial schedules; total (Σnᵢ)!/Πnᵢ!.
B · Merged rule card
6.1.1 Transaction basics: read/write, commit/abort, ACID, transaction states
- Transaction = one logical unit of work: read(X), write(X), ending in commit or abort.
- Atomicity (recovery: undo), Consistency (programmer + constraints), Isolation (concurrency control), Durability (recovery: redo).
- States: active → partially committed → committed; active/partially committed → failed → aborted; committed/aborted = terminated.
6.2.1 Concurrency problems: lost update, dirty read, unrepeatable read, phantom
- Lost update: R1(X) R2(X) W1(X) W2(X).
- Dirty read: read uncommitted data (W1 R2 … A1).
- Unrepeatable read: R1(X) W2(X) C2 R1(X).
- Phantom: re-run query sees inserted/deleted rows; needs predicate/range locks.
- Isolation levels: RU allows dirty; RC stops dirty; RR stops unrepeatable; SERIALIZABLE stops phantoms.
6.3.1 Schedules: serial vs concurrent; counting possible schedules
- Schedule: interleaving that keeps each transaction's order; complete = all end in C/A.
- Serial schedules: n! for n transactions.
- Total schedules: (Σnᵢ)! / Πnᵢ!; non-serial = total − n!.
C · Interleaved GATE-style questions
Q1 · MCQ · 1 mark(s) — ACID
Rolling back an incomplete transaction after a crash preserves:
- (A) Consistency only
- (B) Atomicity
- (C) Durability
- (D) Isolation
Q2 · MCQ · 1 mark(s) — States
Which transition is impossible?
- (A) Committed → Aborted
- (B) Partially committed → Failed
- (C) Active → Failed
- (D) Failed → Aborted
Q3 · NAT · 2 mark(s) — Lost update
X = 40. T1: R(X), X × 3, W(X). T2: R(X), X + 10, W(X). Schedule R2(X) R1(X) W2(X) W1(X). Final X?
Numerical answer: ________
Q4 · MCQ · 1 mark(s) — Anomaly
Which anomaly can REPEATABLE READ still show?
- (A) Dirty read
- (B) None
- (C) Phantom
- (D) Unrepeatable read
Q5 · NAT · 2 mark(s) — Counting
T1 has 3 operations, T2 has 2 and T3 has 2. How many schedules?
Numerical answer: ________
Q6 · NAT · 1 mark(s) — Serial
T1, T2, T3: how many serial schedules?
Numerical answer: ________
Q7 · MSQ · 2 mark(s) — Anomalies
Which schedules contain a dirty read (a read of a value written by a transaction that has not yet committed)?
- (A) W2(B) R1(B) A2 C1
- (B) W1(A) R2(A) C1 C2
- (C) R1(A) W2(A) C2 R1(A) C1
- (D) W1(A) C1 R2(A) C2
Q8 · MCQ · 1 mark(s) — Schedules
In schedule R1(A) R2(A) W2(A) W1(A), which pair is in the wrong order for a valid schedule of T1 = R1(A) W1(A) and T2 = R2(A) W2(A)?
- (A) R1(A) before W1(A)
- (B) none: the schedule is valid
- (C) R2(A) before W2(A)
- (D) W2(A) before W1(A)
D · Answer Vault
Reveal answers when you’re ready
Q1 Answer: (B) · 1 mark(s)
All or nothing.
- (A) is wrong: Not the direct goal.
- (C) is wrong: About committed data.
- (D) is wrong: About interference.
Re-read: Lesson 6.1.1 — Transaction basics: read/write, commit/abort, ACID, transaction states
Q2 Answer: (A) · 1 mark(s)
A committed transaction cannot be rolled back.
- (B) is wrong: Possible.
- (C) is wrong: Possible.
- (D) is wrong: Possible.
Re-read: Lesson 6.1.1 — Transaction basics: read/write, commit/abort, ACID, transaction states
Q3 Answer: 120 · 2 mark(s)
Both read 40; T2 writes 50; T1 writes 120.
Re-read: Lesson 6.2.1 — Concurrency problems: lost update, dirty read, unrepeatable read, phantom
Q4 Answer: (C) · 1 mark(s)
Standard table.
- (A) is wrong: Prevented.
- (B) is wrong: Phantoms remain.
- (D) is wrong: Prevented.
Re-read: Lesson 6.2.1 — Concurrency problems: lost update, dirty read, unrepeatable read, phantom
Q5 Answer: 210 · 2 mark(s)
7!/(3!2!2!) = 5040/24.
Re-read: Lesson 6.3.1 — Schedules: serial vs concurrent; counting possible schedules
Q6 Answer: 6 · 1 mark(s)
3!.
Re-read: Lesson 6.3.1 — Schedules: serial vs concurrent; counting possible schedules
Q7 Answer: (A) (B) · 2 mark(s)
A: T2 reads A before T1 commits. D: T1 reads T2's B before T2 aborts.
- (C) is wrong: That is an unrepeatable read (T2 committed first).
- (D) is wrong: T1 committed before the read.
Re-read: Lesson 6.2.1 — Concurrency problems: lost update, dirty read, unrepeatable read, phantom
Q8 Answer: (B) · 1 mark(s)
Each transaction's own order is kept; the interleaving is free.
- (A) is wrong: Correct order.
- (C) is wrong: Correct order.
- (D) is wrong: Cross-transaction order is free.
Re-read: Lesson 6.3.1 — Schedules: serial vs concurrent; counting possible schedules