Conflict Serializability | Database Management System (DBMS) - Computer Science Engineering (CSE) PDF Download

Conflict Serializability in DBMS

As discussed in Concurrency control, serial schedules have less resource utilization and low throughput. To improve it, two or more transactions are run concurrently. But concurrency of transactions may lead to inconsistency in database. To avoid this, we need to check whether these concurrent schedules are serializable or not.

Conflict Serializable: A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-conflicting operations.

Conflicting operations: Two operations are said to be conflicting if all conditions satisfy: 

  • They belong to different transactions
  • They operate on the same data item
  • At Least one of them is a write operation

Example:

  • Conflicting operations pair (R1(A), W2(A)) because they belong to two different transactions on same data item A and one of them is write operation.
  • Similarly, (W1(A), W2(A)) and (W1(A), R2(A)) pairs are also conflicting.
  • On the other hand, (R1(A), W2(B)) pair is non-conflicting because they operate on different data item.
  • Similarly, ((W1(A), W2(B)) pair is non-conflicting.

Consider the following schedule:
S1: R1(A), W1(A), R2(A), W2(A), R1(B), W1(B), R2(B), W2(B)
If Oi and Oj are two operations in a transaction and Oi< Oj (Oi is executed before Oj), same order will follow in the schedule as well. Using this property, we can get two transactions of schedule S1 as:
T1: R1(A), W1(A), R1(B), W1(B)
T2: R2(A), W2(A), R2(B), W2(B)

1. Possible Serial Schedules are: T1 → T2 or T2 → T1 
Swapping non-conflicting operations R2(A) and R1(B) in S1, the schedule becomes,
S11: R1(A), W1(A), R1(B), W2(A), R2(A), W1(B), R2(B), W2(B)
Similarly, swapping non-conflicting operations W2(A) and W1(B) in S11, the schedule becomes,
S12: R1(A), W1(A), R1(B), W1(B), R2(A), W2(A), R2(B), W2(B)
S12 is a serial schedule in which all operations of T1 are performed before starting any operation of T2. Since S has been transformed into a serial schedule S12 by swapping non-conflicting operations of S1, S1 is conflict serializable.
Let us take another Schedule:
S2: R2(A), W2(A), R1(A), W1(A), R1(B), W1(B), R2(B), W2(B)
Two transactions will be:  
T1: R1(A), W1(A), R1(B), W1(B)
T2: R2(A), W2(A), R2(B), W2(B)
2. Possible Serial Schedules are: T1 → T2 or T2 → T1 
Original Schedule is: 
S2: R2(A), W2(A), R1(A), W1(A), R1(B), W1(B), R2(B), W2(B)
Swapping non-conflicting operations R1(A) and R2(B) in S2, the schedule becomes,
S21: R2(A), W2(A), R2(B), W1(A), R1(B), W1(B), R1(A), W2(B)
Similarly, swapping non-conflicting operations W1(A) and W2(B) in S21, the schedule becomes,  
S22: R2(A), W2(A), R2(B), W2(B), R1(B), W1(B), R1(A), W1(A)
In schedule S22, all operations of T2 are performed first, but operations of T1 are not in order (order should be R1(A), W1(A), R1(B), W1(B)). So S2 is not conflict serializable.

Conflict Equivalent: Two schedules are said to be conflict equivalent when one can be transformed to another by swapping non-conflicting operations. In the example discussed above, S11 is conflict equivalent to S1 (S1 can be converted to S11 by swapping non-conflicting operations). Similarly, S11 is conflict equivalent to S12 and so on.

Note 1: Although S2 is not conflict serializable, but still it is conflict equivalent to S21 and S21 because S2 can be converted to S21 and S22 by swapping non-conflicting operations.

Note 2: The schedule which is conflict serializable is always conflict equivalent to one of the serial schedule. S1 schedule discussed above (which is conflict serializable) is equivalent to serial schedule (T1->T2).

Question: Consider the following schedules involving two transactions. Which one of the following statement is true?    [GATE 2007]
S1: R1(X) R1(Y) R2(X) R2(Y) W2(Y) W1(X)
S2: R1(X) R2(X) R2(Y) W2(Y) R1(Y) W1(X)
(a) Both S1 and S2 are conflict serializable
(b) Only S1 is conflict serializable
(c) Only S2 is conflict serializable
(d) None

Ans: (c)
Solution: Two transactions of given schedules are:
T1: R1(X) R1(Y) W1(X)
T2: R2(X) R2(Y) W2(Y)
Let us first check serializability of S1:
S1: R1(X) R1(Y) R2(X) R2(Y) W2(Y) W1(X)
To convert it to a serial schedule, we have to swap non-conflicting operations so that S1 becomes equivalent to serial schedule T1 → T2 or T2 → T1. In this case, to convert it to a serial schedule, we must have to swap R2(X) and W1(X) but they are conflicting. So S1 can’t be converted to a serial schedule.
Now, let us check serializability of S2:
S2: R1(X) R2(X) R2(Y) W2(Y) R1(Y) W1(X)
Swapping non conflicting operations R1(X) and R2(X) of S2, we get
S2’: R2(X) R1(X) R2(Y) W2(Y) R1(Y) W1(X)
Again, swapping non conflicting operations R1(X) and R2(Y) of S2’, we get
S2’’: R2(X) R2(Y) R1(X) W2(Y) R1(Y) W1(X)
Again, swapping non conflicting operations R1(X) and W2(Y) of S2’’, we get
S2’’’: R2(X) R2(Y) W2(Y) R1(X) R1(Y) W1(X)
which is equivalent to a serial schedule T2 → T1.
So, correct option is C. Only S2 is conflict serializable.

The document Conflict Serializability | Database Management System (DBMS) - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Database Management System (DBMS).
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
62 videos|66 docs|35 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Conflict Serializability - Database Management System (DBMS) - Computer Science Engineering (CSE)

1. What is conflict serializability in DBMS?
Ans. Conflict serializability in DBMS refers to a property that ensures the execution of transactions in a database does not result in any conflicts, such as data inconsistency or incorrect results. It guarantees that the final outcome of concurrent transactions is equivalent to a serial execution of those transactions.
2. How does conflict serializability affect database performance?
Ans. Conflict serializability can impact database performance as it requires careful management of concurrent transactions. Ensuring conflict serializability often involves implementing locking mechanisms or using concurrency control techniques, which can introduce additional overhead and potentially decrease the overall throughput of the system.
3. What are the common techniques used to achieve conflict serializability in DBMS?
Ans. There are several techniques used to achieve conflict serializability in DBMS, including locking, timestamp ordering, and optimistic concurrency control. Locking involves acquiring and releasing locks on database objects to ensure exclusive access. Timestamp ordering uses timestamps to order the execution of transactions, while optimistic concurrency control allows concurrent execution of transactions and detects conflicts during commit.
4. What are the consequences of violating conflict serializability in a database?
Ans. Violating conflict serializability in a database can lead to data inconsistencies and incorrect results. It may cause conflicts such as dirty reads, non-repeatable reads, and lost updates, where the final outcome of concurrent transactions differs from the expected result of a serial execution. This can compromise the integrity and reliability of the database.
5. How can conflict serializability be ensured in a distributed database system?
Ans. Ensuring conflict serializability in a distributed database system involves additional challenges due to the presence of multiple nodes and the potential for network delays. Techniques such as two-phase locking, distributed concurrency control protocols, and distributed transaction managers are used to coordinate and synchronize the execution of transactions across multiple nodes, ensuring conflict serializability in a distributed environment.
62 videos|66 docs|35 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Conflict Serializability | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

pdf

,

Viva Questions

,

Conflict Serializability | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

Semester Notes

,

Conflict Serializability | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

mock tests for examination

,

Exam

,

Summary

,

past year papers

,

video lectures

,

MCQs

,

ppt

,

Important questions

,

Sample Paper

,

Objective type Questions

,

Extra Questions

,

shortcuts and tricks

,

Previous Year Questions with Solutions

,

Free

,

practice quizzes

,

study material

;