T1: read (P) ; read (Q) ; if P = 0 then Q : = Q + 1 ; write (Q) ; T2: read (Q) ; read (P) ; if Q = 0 then P : = P + 1 ; write (P) ;Any non-serial interleaving of T1 and T2 for concurrent execution leads to
A serializable schedule
A schedule that is not conflict serializable
A conflict serializable schedule
A schedule for which a precedence graph cannot be drawn
Both I and II
Neither I nor II
2 Phase Locking (2PL) is a concurrency control method that guarantees serializability. The protocol utilizes locks, applied by a transaction to data, which may block (interpreted as signals to stop) other transactions from accessing the same data during the transaction’s life. 2PL may be lead to deadlocks that result from the mutual blocking of two or more transactions. See the following situation, neither T3 nor T4 can make progress.
Timestamp-based concurrency control algorithm is a non-lock concurrency control method. In Timestamp based method, deadlock cannot occur as no transaction ever waits.
T1 can complete before T2 and T3 as there is no conflict between Write(X) of T1 and the operations in T2 and T3 which occur before Write(X) of T1 in the above diagram.
T3 should can complete before T2 as the Read(Y) of T3 doesn’t conflict with Read(Y) of T2. Similarly, Write(X) of T3 doesn’t conflict with Read(Y) and Write(Y) operations of T2.
Another way to solve this question is to create a dependency graph and topologically sort the dependency graph. After topologically sorting, we can see the sequence T1, T3, T2.
S is conflict-serializable but not recoverable
S is not conflict-serializable but is recoverable
S is both conflict-serializable and recoverable
S is neither conflict-serializable nor is it recoverable
T1: r1(X); r1(Z); w1(X); w1(Z) T2: r2(Y); r2(Z); w2(Z) T3: r3(Y); r3(X); w3(Y) S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z) S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)Which one of the following statements about the schedules is TRUE?
Only S1 is conflict-serializable.
Only S2 is conflict-serializable.
Both S1 and S2 are conflict-serializable.
Neither S1 nor S2 is conflict-serializable.
1. T1 start 2. T1 B old=12000 new=10000 3. T1 M old=0 new=2000 4. T1 commit 5. T2 start 6. T2 B old=10000 new=10500 7. T2 commitSuppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?
We must redo log record 6 to set B to 10500
We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.
We need not redo log records 2 and 3 because transaction T1 has committed.
We can apply redo and undo operations in arbitrary order because they are idempotent
A transaction writes a data item after it is read by an uncommitted transaction
A transaction reads a data item after it is read by an uncommitted transaction
A transaction reads a data item after it is written by a committed transaction
A transaction reads a data item after it is written by an uncommitted transaction
The schedule is serializable as T2; T3; T1
The schedule is serializable as T2; T1; T3
The schedule is serializable as T3; T2; T1
The schedule is not serializable
read(x); x := x – 50; write(x); read(y); y := y + 50; write(y)The constraint that the sum of the accounts x and y should remain constant is that of
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7); (checkpoint); (start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3); (write, T3, z, 7, 2);If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list
Undo: T3, T1; Redo: T2
Undo: T3, T1; Redo: T2, T4
Undo: none; Redo: T2, T4, T3; T1
Undo: T3, T1, T4; Redo: T2
T2 must be aborted and then both T1 and T2 must be re-started to ensure transaction atomicity
Schedule S is non-recoverable and cannot ensure transaction atomicity
Only T2 must be aborted and then re-started to ensure transaction atomicity
Schedule S is recoverable and can ensure atomicity and nothing else needs to be done
Page, table and row level locking allow the same degree of concurrency
- Page level locking locks whole page i.e all rows therefore highly restrictive
- Table locking is mainly used for concurrency control with DDL operations
- A row share table lock is the least restrictive, and has the highest degree of concurrency for a table.It indicates the transaction has locked rows in the table and intends to update them.
guarantee serializability and deadlock-freedom
guarantee neither serializability nor deadlock-freedom
guarantee serializability but not deadlock-freedom
guarantee deadlock-freedom but not serializability
- No possibility of deadlock.
- Ensure serializability.
- Less throughput and resource utilisation because it holds the resources before the transaction begins execution.
- Starvation is possible since no restriction on unlock operation.
- 2pl is a deadlock free protocol but it is difficult to use in practice.
Ascending order of transaction indices
S = r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2;where ri(Z) denotes a read operation by transaction Ti on a variable Z, wi(Z) denotes a write operation by Ti on a variable Z and ai denotes an abort by transaction Ti . Which one of the following statements about the above schedule is TRUE?
S is non-recoverable
S is recoverable, but has a cascading abort
S does not have a cascading abort
S is strict
- T2 overwrites a value that T1 writes
- T1 aborts: its “remembered” values are restored.
- Cascading Abort could have arised if - > Abort of T1 required abort of T2 but as T2 is already aborted , its not a cascade abort. Therefore, Option C
(S1) 2RA 2WA 3RC 2WB 3WA 3WC 1RA 1RB 1WA 1WB
(S2) 3RC 2RA 2WA 2WB 3WA 1RA 1RB 1WA 1WB 3WC
(S3) 2RA 3RC 3WA 2WA 2WB 3WC 1RA 1RB 1WA 1WB
Which of the following statements is TRUE?
S1, S2 and S3 are all conflict equivalent to each other
No two of S1, S2 and S3 are conflict equivalent to each other
S2 is conflict equivalent to S3, but not to S1
S1 is conflict equivalent to S2, but not to S3
A: A schedule following strict two phase locking protocol is conflict serializable as well as recoverable.
B: Checkpoint in schedules are inserted to ensure recoverability.
Both 1 and 2