Quick answer: A transaction is a group of database operations that forms one logical unit of work. It must satisfy ACID: atomicity and durability (recovery manager), isolation (concurrency-control manager) and consistency (programmer or DBA). Interleaved execution is described by schedules. A schedule is serializable if it is equivalent to some serial schedule, which you test with conflict serializability (acyclic precedence graph) or the broader view serializability. Schedules are also classed by recoverability: recoverable, cascadeless and strict. Two-phase locking (2PL) and timestamp ordering are protocols that only allow safe schedules.
Transactions questions show up regularly in GATE: testing conflict and view serializability, classifying schedules by recoverability, and checking whether 2PL or timestamp ordering would allow a schedule. This chapter page maps the area and links to four detailed notes.
Chapter overview
| Topic | Key ideas | Detailed notes |
|---|---|---|
| Transactions, ACID and recovery | Read/write operations, ACID, logs, undo, redo, checkpoints | ACID and log-based recovery |
| Serializability | Serial vs concurrent schedules, conflict pairs, precedence graph, view serializability | Conflict and view serializability |
| Recoverability | Dirty read, cascading rollback, recoverable, cascadeless and strict schedules | Recoverable, cascadeless and strict schedules |
| Concurrency control | Shared and exclusive locks, 2PL variants, timestamp ordering, Thomas write rule | 2PL and timestamp ordering |
Why concurrency needs control
- In a simple file system, a whole file is often locked as one resource, so only one user can change it at a time.
- A DBMS can lock individual records, so many users can work at once.
- More concurrency means better throughput and response time, but without control it can produce wrong results.
ACID at a glance
| Property | Meaning | Ensured by |
|---|---|---|
| Atomicity | All operations happen, or none do | Recovery manager (undo) |
| Consistency | A correct transaction moves the database from one consistent state to another | Programmer / DBA (plus integrity constraints) |
| Isolation | Concurrent execution gives the same result as some serial order | Concurrency-control manager |
| Durability | Committed changes survive failures | Recovery manager (redo, logs, backups, RAID) |
Schedules in brief
- Serial schedule: transactions run one after another. n transactions have n! serial schedules. Always consistent, but no concurrency.
- Concurrent schedule: operations interleave. Two transactions with n and m operations have this many interleavings:
- Conflicting pair: two operations on the same item, from different transactions, with at least one write (R-W, W-R or W-W).
- Conflict serializable: the precedence graph is acyclic. Its topological orders are the equivalent serial orders.
- View serializable: same initial reads, reads-from relationships and final writes as some serial schedule. Every conflict-serializable schedule is view serializable, and a view-serializable schedule that is not conflict serializable must contain blind writes.
Recoverability in brief
| Class | Rule |
|---|---|
| Recoverable | If Tj reads a value written by Ti, Tj commits only after Ti commits |
| Cascadeless | Transactions read only committed values (no dirty reads) |
| Strict | No transaction reads or writes an item last written by an uncommitted transaction |
Strict ⊂ cascadeless ⊂ recoverable.
Concurrency control protocols in brief
| Protocol | Serializability | Strict schedules | Deadlock free |
|---|---|---|---|
| Basic 2PL | Conflict | No | No |
| Strict 2PL | Conflict | Yes | No |
| Rigorous 2PL | Conflict | Yes | No |
| Conservative 2PL | Conflict | Not guaranteed | Yes |
| Basic timestamp ordering | Conflict | No | Yes |
| Thomas write rule | View | No | Yes |
| Strict timestamp ordering | Conflict | Yes | Yes |
Worked example
Question: S: R1(A), W2(A), W1(A), W3(A). Is S conflict serializable? Is it view serializable?
Step 1: R1(A) before W2(A) gives T1 → T2. W2(A) before W1(A) gives T2 → T1. The precedence graph has a cycle, so S is not conflict serializable.
Step 2: T1 reads the initial A, T3 makes the final write, and there are no other reads. The serial order T1, T2, T3 has the same initial read and final write, so S is view serializable.
Step 3: W2(A) and W3(A) are blind writes, which is why S can be view serializable without being conflict serializable.
Exam tips
- Treat every schedule question as three separate checks: is it serializable, is it recoverable, and would the named protocol allow it?
- For serializability, draw the precedence graph before anything else.
- For recoverability, look only at reads and writes of items written by uncommitted transactions, then compare commit order.
Common mistakes
- Treating operations on different items as conflicts. A conflict needs the same data item.
- Assuming view serializable means conflict serializable. It's the other way round.
- Assuming serializable means recoverable. The two properties are independent.
- Thinking basic 2PL prevents cascading rollbacks. You need strict 2PL for that.
Practice questions
Q1. How many serial schedules exist for 4 transactions?
Answer: 4! = 24.
Q2. T1 has 3 operations and T2 has 2. How many concurrent schedules keep each transaction's own order?
Answer:
Q3. Which ACID property is mainly the programmer's responsibility?
Answer: Consistency.
FAQs
What is a transaction in DBMS?
It is a sequence of database operations treated as one logical unit of work. Either all of it takes effect or none of it does.
What is the difference between conflict and view serializability?
Conflict serializability means the schedule can be turned into a serial one by swapping adjacent non-conflicting operations. View serializability only needs the same initial reads, reads-from relationships and final writes, so it is the broader class.
Does two-phase locking prevent deadlock?
No. Basic, strict and rigorous 2PL can all deadlock. Only conservative 2PL avoids it, by taking every lock in advance.
What is a cascadeless schedule?
It is a schedule where every transaction reads only values written by committed transactions, so one abort never forces others to roll back.
How many interleavings do two transactions with n and m operations have?
They have (n+m)! / (n! × m!) interleavings that keep each transaction's own operation order.
Conclusion
Work through the detailed notes on ACID and recovery, serializability, recoverability and concurrency control protocols. For storage-level background, see File Organization and Indexing.