The Wayback Machine - https://web.archive.org/web/20240817051433/https://www.geeksforgeeks.org/conflict-serializability-in-dbms/
Open In App

Conflict Serializability in DBMS

Last Updated : 21 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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

Conflict Serializable

Concurrency serializability, also known as conflict serializability, is a type of concurrency control that guarantees that the outcome of concurrent transactions is the same as if the transactions were executed consecutively.

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

Non-conflicting operations: When two operations operate on separate data items or the same data item but at least one of them is a read operation, they are said to be non-conflicting.

Conflicting Operations

Two operations are said to be conflicting if all conditions are satisfied: 

  • 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 the same data item A and one of them is a write operation.
  • Similarly, (W1(A), W2(A)) and (W1(A), R2(A)) pairs are also conflicting.
  • On the other hand, the (R1(A), W2(B)) pair is non-conflicting because they operate on different data items.
  • 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: 

T1: R1(A), W1(A), R1(B), W1(B)
T2: R2(A), W2(A), R2(B), W2(B)

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)

Possible Serial Schedules are: T1->T2 or T2->T1 

Original Schedule is as:  

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, still it is conflict equivalent to S21 and S22 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 the serial schedule (T1->T2).

GATE Question

Question: Consider the following schedules involving two transactions. Which one of the following statements 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) 

  • Both S1 and S2 are conflict serializable
  • Only S1 is conflict serializable
  • Only S2 is conflict serializable
  • None

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. 

Advantages of Conflict Serializability

  • Consistency: Conflict serializability guarantees that the transactions’ outcomes correspond to the sequence in which they were carried out.
  • Correctness: Regardless of the order in which transactions were submitted, conflict serializability guarantees that transactions are executed correctly.
  • Decreased Overhead: By doing away with pointless locking and other conflict resolution techniques, conflict serializability lowers overhead.
  • Enhanced Concurrency: By enabling concurrent execution of operations without causing conflicts, conflict serializability enhances concurrency.

Disadvantages of Conflict Serializability

  • Complexity: Conflict serializability can be complex to implement, especially in large and complex databases.
  • Reduced Performance: Conflict serializability can reduce performance by introducing delays and overhead due to locking and other conflict resolution mechanisms.
  • Limited Concurrency: Conflict serializability can limit the degree of concurrency in the system because it may delay some transactions to avoid conflicts.
  • Increased Overhead: Conflict serializability requires additional overhead to maintain the order of the transactions and ensure that they do not conflict with each other.

Conclusion

  • The consistency of the database is guaranteed via conflict serializability, even in situations when several transactions are running simultaneously.
  • Schedules that are conflict serializable are always view serializable.
  • Compared to view serializability, conflict serializability is simpler to accomplish.


Previous Article
Next Article

Similar Reads

Precedence Graph for Testing Conflict Serializability in DBMS
A Precedence Graph or Serialization Graph is used commonly to test the Conflict Serializability of a schedule. It is a directed Graph (V, E) consisting of a set of nodes V = {T1, T2, T3..........Tn} and a set of directed edges E = {e1, e2, e3..................em}. The graph contains one node for each Transaction Ti. An edge ei is of the form Tj --
6 min read
Difference between Conflict and View Serializability
Prerequisite - Types of Schedules in DBMS Serializable Schedule : A transaction schedule is serializable if its outcome is equal to the outcome of its transactions executed serially i.e. sequentially without overlapping in time. A serializable schedule always leaves the database in consistent state. A serial schedule is always a serializable schedu
4 min read
Result Serializability in DBMS
Prerequisite - Serializable Schedules Equivalence of Schedules : A schedule is a way of representing the order in which the operations of transactions get executed. Based on different properties related to the schedules such as end result, the order of execution of transactions two schedules might be equivalent. Equivalence of schedules is classifi
2 min read
Serializability in DBMS
In this article, we are going to explain the serializability concept and how this concept affects the DBMS deeply, we also understand the concept of serializability with some examples, and we will finally conclude this topic with an example of the importance of serializability. The DBMS form is the foundation of the most modern applications, and wh
9 min read
View Serializability in DBMS
Prerequisite - Types of Schedules in DBMS  The View serializability is a concept that is used to compute whether schedules are View-Serializable or not. A schedule is said to be View-Serializable if it is view equivalent to a Serial Schedule (where no interleaving of transactions is possible).  Need of View-SerializabilityThere may be some schedule
5 min read
Polygraph to check View Serializability in DBMS
Prerequisite - Concurrency Control -Introduction, Conflict Serializability, Transaction Isolation Levels in DBMS Serializability: If any transaction (non-serial) produces an outcome that is equal to the outcome of that schedule's transaction executed serially then we can call that transaction schedule a Serializable schedule. Note: The main objecti
6 min read
Equivalent Serial Schedule of Conflict Serializable Schedule in DBMS
Prerequisite: Conflict Serializability, Precedence Graph Conflict Serializable Schedule: A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-conflicting operations. The serial schedule of the Conflict Serializable Schedule can be found by applying topological Sorting on the Precedence Graph of
12 min read
Need for DBMS
A Data Base Management System is a system software for easy, efficient and reliable data processing and management. It can be used for: Creation of a database.Retrieval of information from the database.Updating the database.Managing a database.Multiple User InterfaceData scalability, expandability and flexibility: We can change schema of the databa
4 min read
Introduction of Relational Model and Codd Rules in DBMS
Pre-Requisite: Relational Model in DBMS It was proposed by Dr. E.F. Codd. It uses the concept of relations to represent each and every file. Relations are Two-Dimensional Tables. It is easy to implement and easy to simplification in the operations to manipulate the data. This is the most popular data model. It is simple to implement. It uses the pr
12 min read
Thomas Write Rule in DBMS
The "write rule" in database management systems (DBMS) refers to a principle that governs how changes to the database are handled. Specifically, the write rule states that any modification to a database must be written to disk before control is returned to the user. In other words, when a user executes a command that modifies the database (such as
5 min read
Armstrong's Axioms in Functional Dependency in DBMS
Prerequisite - Functional Dependencies This article contains Armstrong's Axioms and how Armstrong's Axioms are used to decide about the functional dependency on the database. We will be also learning about the Secondary Rules and Armstrong Relations. We will learn each thing in detail. Before moving ahead, you must have a knowledge of Functional De
4 min read
Transaction Isolation Levels in DBMS
Prerequisite - Concurrency control in DBMS, ACID Properties in DBMS As we know, in order to maintain consistency in a database, it follows ACID properties. Among these four properties (Atomicity, Consistency, Isolation, and Durability) Isolation determines how transaction integrity is visible to other users and systems. It means that a transaction
5 min read
Database Objects in DBMS
A database object is any defined object in a database that is used to store or reference data.Anything which we make from create command is known as Database Object.It can be used to hold and manipulate the data.Some of the examples of database objects are : view, sequence, indexes, etc. Table - Basic unit of storage; composed rows and columns View
4 min read
Starvation in DBMS
Starvation or Livelock is the situation when a transaction has to wait for an indefinite period of time to acquire a lock. Reasons for Starvation:If the waiting scheme for locked items is unfair. ( priority queue )Victim selection (the same transaction is selected as a victim repeatedly )Resource leak.Via denial-of-service attack.Starvation can be
5 min read
Graph Based Concurrency Control Protocol in DBMS
Graph-based concurrency control protocols are used in database management systems (DBMS) to ensure that concurrent transactions do not interfere with each other and maintain the consistency of the database. In graph-based concurrency control, transactions are represented as nodes in a graph, and the conflicts between transactions are represented as
4 min read
Introduction to TimeStamp and Deadlock Prevention Schemes in DBMS
Deadlock occurs when each transaction T in a schedule of two or more transactions waiting for some item locked by some other transaction T' in the set. Thus, both end up in a deadlock situation, waiting for the other to release the lock on the item. Deadlocks are a common problem and we have introduced the problem while solving the Concurrency Cont
7 min read
Tuple in DBMS
Pre-requisites: Introduction of DBMS A tuple, also known as a record or row, is a basic unit of data in a relational database management system (DBMS). A tuple represents a single instance of a relation, or table, in the database. Each tuple contains a set of values, or attributes, that correspond to the columns, or fields, of the relation. E.F. Co
4 min read
Implementation of Locking in DBMS
Locking protocols are used in database management systems as a means of concurrency control. Multiple transactions may request a lock on a data item simultaneously. Hence, we require a mechanism to manage the locking requests made by transactions. Such a mechanism is called a Lock Manager. It relies on the process of message passing where transacti
5 min read
Tuple Relational Calculus (TRC) in DBMS
Tuple Relational Calculus (TRC) is a non-procedural query language used in relational database management systems (RDBMS) to retrieve data from tables. TRC is based on the concept of tuples, which are ordered sets of attribute values that represent a single row or record in a database table. TRC is a declarative language, meaning that it specifies
4 min read
Difference between OLAP and OLTP in DBMS
Pre-Requisite: OLAP, OLTP OLAP stands for Online Analytical Processing. OLAP systems have the capability to analyze database information of multiple systems at the current time. The primary goal of OLAP Service is data analysis and not data processing. OLTP stands for Online Transaction Processing. OLTP has the work to administer day-to-day transac
5 min read
Types of Schedules in DBMS
Schedule, as the name suggests, is a process of lining the transactions and executing them one by one. When there are multiple transactions that are running in a concurrent manner and the order of operation is needed to be set so that the operations do not overlap each other, Scheduling is brought into play and the transactions are timed accordingl
7 min read
Fragmentation in Distributed DBMS
Fragmentation is a process of dividing the whole or full database into various subtables or sub relations so that data can be stored in different systems. The small pieces or sub relations or subtables are called fragments. These fragments are called logical data units and are stored at various sites. It must be made sure that the fragments are suc
5 min read
Challenges of database security in DBMS
Seeing the vast increase in volume and speed of threats to databases and many information assets, research efforts need to be consider to the following issues such as data quality, intellectual property rights, and database survivability. Let's discuss them one by one. 1. Data quality - The database community basically needs techniques and some org
5 min read
Schema Integration in DBMS
Definition: Schema integration is used to merge two or more database schemas into a single schema that can store data from both the original databases. For large databases with many expected users and applications, the integration approach of designing individual schema and then merging them can be used. Because the individual views can be kept rel
5 min read
Difference between Row oriented and Column oriented data stores in DBMS
Row-oriented and column-oriented data stores are two different approaches to storing and organizing data in relational database management systems (RDBMS). Row-Oriented Database work by organizing the data into rows and Column-Oriented Databases work by organizing the data into columns. Row-Oriented DatabaseIn a row-oriented data store, data is sto
4 min read
Domain Key Normal Form in DBMS
Prerequisites - Normal Forms, 4th and 5th Normal form, find the highest normal form of a relation It is basically a process in database to organize data efficiently. Basically there are two goals of doing normalization these are as follows: To remove repeated data or in simple words we can say to remove redundant data.Second one is to ensure that t
4 min read
Interfaces in DBMS
A database management system (DBMS) interface is a user interface that allows for the ability to input queries to a database without using the query language itself. User-friendly interfaces provided by DBMS may include the following: Menu-Based InterfacesForms-Based InterfacesGraphical User InterfacesNatural Language InterfacesSpeech Input and Out
4 min read
Why recovery is needed in DBMS
Basically, whenever a transaction is submitted to a DBMS for execution, the operating system is responsible for making sure or to be confirmed that all the operations which need to be performed in the transaction have been completed successfully and their effect is either recorded in the database or the transaction doesn't affect the database or an
6 min read
Economic factors (Choice of DBMS)
Basically, the choice of a DBMS is governed by a number of factors such as: Technical Economics Politics of Organization Here we will basically discuss Non-technical factors which include the financial status and the support organization of the vendor. In this article, we will concentrate on discussing the economic and organizational factors that a
2 min read
Categories of End Users in DBMS
Pre-Requisite: Different Types of End Users End users are basically those people whose jobs require access to the database for querying, updating, and generating reports. The database primarily exists for their use. There are several categories of end-users these are as follows. Casual End usersNaive or Parametric End UsersApplication ProgrammersSo
3 min read
three90RightbarBannerImg