SlideShare a Scribd company logo
DBMS (UNIT 4)
BY:SURBHI SAROHA
SYLLABUS
 Transaction Processing
 Transaction system
 Testing of serializability
 Recoverable schedule
 Concurrency control
 Locking techniques for concurrency control
 Time stamping protocols for concurrency control
 Validation based protocol
 Multiple granularity
 Recovery from transaction failures
 Log based recovery
 Checkpoints
 Shadow paging
 Deadlock handling
TRANSACTION PROCESSING
 The transaction is a set of logically related operation. It contains a
group of tasks.
 A transaction is an action or series of actions. It is performed by a single
user to perform operations for accessing the contents of the database.
 Example: Suppose an employee of bank transfers Rs 800 from X's
account to Y's account. This small transaction contains several low-level
tasks:
X'S ACCOUNT
 Open_Account(X)
 Old_Balance = X.balance
 New_Balance = Old_Balance - 800
 X.balance = New_Balance
 Close_Account(X)
Y'S ACCOUNT
 Open_Account(Y)
 Old_Balance = Y.balance
 New_Balance = Old_Balance + 800
 Y.balance = New_Balance
 Close_Account(Y)
OPERATIONS OF TRANSACTION:
 Following are the main operations of transaction:
 Read(X): Read operation is used to read the value of X from the database
and stores it in a buffer in main memory.
 Write(X): Write operation is used to write the value back to the database
from the buffer.
 Let's take an example to debit transaction from an account which consists
of following operations:
 1. R(X);
 2. X = X - 500;
 3. W(X);
CONT…..
 Let's assume the value of X before starting of the transaction is 4000.
 The first operation reads X's value from database and stores it in a buffer.
 The second operation will decrease the value of X by 500. So buffer will
contain 3500.
 The third operation will write the buffer's value to the database. So X's final
value will be 3500.
 But it may be possible that because of the failure of hardware, software or
power, etc. that transaction may fail before finished all the operations in the
set.
CONT….
 For example: If in the above transaction, the debit transaction fails
after executing operation 2 then X's value will remain 4000 in the
database which is not acceptable by the bank.
 To solve this problem, we have two important operations:
 Commit: It is used to save the work done permanently.
 Rollback: It is used to undo the work done.

ACID PROPERTIES
 A transaction is a very small unit of a program and it may contain
several lowlevel tasks. A transaction in a database system must
maintain Atomicity, Consistency, Isolation, and Durability − commonly
known as ACID properties − in order to ensure accuracy, completeness,
and data integrity.
CONT….
 Atomicity − This property states that a transaction must be treated as
an atomic unit, that is, either all of its operations are executed or none.
There must be no state in a database where a transaction is left partially
completed. States should be defined either before the execution of the
transaction or after the execution/abortion/failure of the transaction.
 Consistency − The database must remain in a consistent state after any
transaction. No transaction should have any adverse effect on the data
residing in the database. If the database was in a consistent state before
the execution of a transaction, it must remain consistent after the
execution of the transaction as well.
CONT…..
 Durability − The database should be durable enough to hold all its latest
updates even if the system fails or restarts. If a transaction updates a chunk
of data in a database and commits, then the database will hold the
modified data. If a transaction commits but the system fails before the data
could be written on to the disk, then that data will be updated once the
system springs back into action.
 Isolation − In a database system where more than one transaction are
being executed simultaneously and in parallel, the property of isolation
states that all the transactions will be carried out and executed as if it is the
only transaction in the system. No transaction will affect the existence of
any other transaction.
TESTING OF SERIALIZABILITY
 Serialization Graph is used to test the Serializability of a schedule.
 Assume a schedule S. For S, we construct a graph known as precedence graph. This
graph has a pair G = (V, E), where V consists a set of vertices, and E consists a set of
edges. The set of vertices is used to contain all the transactions participating in the
schedule. The set of edges is used to contain all edges Ti ->Tj for which one of the
three conditions holds:
 Create a node Ti → Tj if Ti executes write (Q) before Tj executes read (Q).
 Create a node Ti → Tj if Ti executes read (Q) before Tj executes write (Q).
 Create a node Ti → Tj if Ti executes write (Q) before Tj executes write (Q).
If a precedence graph contains a single edge Ti → Tj, then all the instructions of Ti are
executed before the first instruction of Tj is executed.
If a precedence graph for schedule S contains a cycle, then S is non-serializable. If the
precedence graph has no cycle, then S is known as serializable.
RECOVERABLE SCHEDULE
 Recoverability is a property of database systems that ensures that, in
the event of a failure or error, the system can recover the database to a
consistent state. Recoverability guarantees that all committed
transactions are durable and that their effects are permanently stored in
the database, while the effects of uncommitted transactions are undone
to maintain data consistency.
CONT…..
 The recoverability property is enforced through the use of transaction
logs, which record all changes made to the database during transaction
processing. When a failure occurs, the system uses the log to recover
the database to a consistent state, which involves either undoing the
effects of uncommitted transactions or redoing the effects of
committed transactions.
THERE ARE SEVERAL LEVELS OF
RECOVERABILITY THAT CAN BE SUPPORTED
BY A DATABASE SYSTEM:
 No-undo logging: This level of recoverability only guarantees that
committed transactions are durable, but does not provide the ability to
undo the effects of uncommitted transactions.
 Undo logging: This level of recoverability provides the ability to undo
the effects of uncommitted transactions but may result in the loss of
updates made by committed transactions that occur after the failed
transaction.
CONT….
 Redo logging: This level of recoverability provides the ability to redo
the effects of committed transactions, ensuring that all committed
updates are durable and can be recovered in the event of failure.
 Undo-redo logging: This level of recoverability provides both undo
and redo capabilities, ensuring that the system can recover to a
consistent state regardless of whether a transaction has been
committed or not.
RECOVERABLE SCHEDULES:
 Schedules in which transactions commit only after all transactions
whose changes they read commit are called recoverable schedules. In
other words, if some transaction Tj is reading value updated or written
by some other transaction Ti, then the commit of Tj must occur after the
commit of Ti.
EXAMPLE : CONSIDER THE FOLLOWING SCHEDULE
INVOLVING TWO TRANSACTIONS T1 AND T2.
THIS IS A RECOVERABLE SCHEDULE SINCE T1 COMMITS
BEFORE T2, THAT MAKES THE VALUE READ BY T2 CORRECT.
CONCURRENCY CONTROL
 Concurrently control is a very important concept of DBMS which ensures
the simultaneous execution or manipulation of data by several processes or
user without resulting in data inconsistency. Concurrency Control deals
with interleaved execution of more than one transaction.
 What is Transaction?
 A set of logically related operations is known as a transaction. The main
operations of a transaction are:
 Read(A): Read operations Read(A) or R(A) reads the value of A from the
database and stores it in a buffer in the main memory.
 Write (A): Write operation Write(A) or W(A) writes the value back to the
database from the buffer.
CONCURRENCY CONTROL IN DBMS
 Executing a single transaction at a time will increase the waiting time of
the other transactions which may result in delay in the overall
execution. Hence for increasing the overall throughput and efficiency of
the system, several transactions are executed.
 Concurrently control is a very important concept of DBMS which
ensures the simultaneous execution or manipulation of data by several
processes or user without resulting in data inconsistency.
 Concurrency control provides a procedure that is able to control
concurrent execution of the operations in the database.
LOCKING TECHNIQUES FOR
CONCURRENCY CONTROL
 In a multiprogramming environment where multiple transactions can
be executed simultaneously, it is highly important to control the
concurrency of transactions. We have concurrency control protocols to
ensure atomicity, isolation, and serializability of concurrent transactions.
Concurrency control protocols can be broadly divided into two
categories −
 Lock based protocols
 Time stamp based protocols
LOCK-BASED PROTOCOLS
 Database systems equipped with lock-based protocols use a
mechanism by which any transaction cannot read or write data until it
acquires an appropriate lock on it. Locks are of two kinds −
 Binary Locks − A lock on a data item can be in two states; it is either
locked or unlocked.
 Shared/exclusive − This type of locking mechanism differentiates the
locks based on their uses. If a lock is acquired on a data item to
perform a write operation, it is an exclusive lock. Allowing more than
one transaction to write on the same data item would lead the
database into an inconsistent state. Read locks are shared because no
data value is being changed.
TWO-PHASE LOCKING 2PL
 This locking protocol divides the execution phase of a transaction into
three parts. In the first part, when the transaction starts executing, it
seeks permission for the locks it requires.
 The second part is where the transaction acquires all the locks. As soon
as the transaction releases its first lock, the third phase starts.
 In this phase, the transaction cannot demand any new locks; it only
releases the acquired locks.
TWO-PHASE LOCKING 2PL
CONT……
 Two-phase locking has two phases, one is growing, where all the locks
are being acquired by the transaction; and the second phase is
shrinking, where the locks held by the transaction are being released.
 To claim an exclusive (write) lock, a transaction must first acquire a
shared (read) lock and then upgrade it to an exclusive lock.
TIMESTAMP-BASED PROTOCOLS
 The most commonly used concurrency protocol is the timestamp based
protocol. This protocol uses either system time or logical counter as a
timestamp.
 Lock-based protocols manage the order between the conflicting pairs
among transactions at the time of execution, whereas timestamp-based
protocols start working as soon as a transaction is created.
 Every transaction has a timestamp associated with it, and the ordering is
determined by the age of the transaction. A transaction created at 0002
clock time would be older than all other transactions that come after it. For
example, any transaction 'y' entering the system at 0004 is two seconds
younger and the priority would be given to the older one.
CONT….
 In addition, every data item is given the latest read and write-
timestamp. This lets the system know when the last ‘read and write’
operation was performed on the data item.
VALIDATION BASED PROTOCOL
 Validation Based Protocol is also called Optimistic Concurrency
Control Technique. This protocol is used in DBMS (Database
Management System) for avoiding concurrency in transactions. It is
called optimistic because of the assumption it makes, i.e. very less
interference occurs, therefore, there is no need for checking while the
transaction is executed.
CONT…..
 In this technique, no checking is done while the transaction is been
executed. Until the transaction end is reached updates in the
transaction are not applied directly to the database. All updates are
applied to local copies of data items kept for the transaction. At the end
of transaction execution, while execution of the transaction,
a validation phase checks whether any of transaction updates violate
serializability. If there is no violation of serializability the transaction is
committed and the database is updated; or else, the transaction is
updated and then restarted.
VALIDATION BASED PROTOCOL
 Optimistic Concurrency Control is a three-phase protocol. The three phases for
validation based protocol:
 Read Phase:
Values of committed data items from the database can be read by a transaction.
Updates are only applied to local data versions.
 Validation Phase:
Checking is performed to make sure that there is no violation of serializability when
the transaction updates are applied to the database.
 Write Phase:
On the success of the validation phase, the transaction updates are applied to the
database, otherwise, the updates are discarded and the transaction is slowed down.
ADVANTAGES:
 1. Avoid Cascading-rollbacks: This validation based scheme avoid
cascading rollbacks since the final write operations to the database are
performed only after the transaction passes the validation phase. If the
transaction fails then no updation operation is performed in the
database. So no dirty read will happen hence possibilities cascading-
rollback would be null.
 2. Avoid deadlock: Since a strict time-stamping based technique is used
to maintain the specific order of transactions. Hence deadlock isn’t
possible in this scheme.
DISADVANTAGES:
 1. Starvation: There might be a possibility of starvation for long-term
transactions, due to a sequence of conflicting short-term transactions
that cause the repeated sequence of restarts of the long-term
transactions so on and so forth. To avoid starvation, conflicting
transactions must be temporarily blocked for some time, to let the
long-term transactions to finish.
MULTIPLE GRANULARITY
 Granularity: It is the size of data item allowed to lock.
 It can be defined as hierarchically breaking up the database into blocks
which can be locked.
 The Multiple Granularity protocol enhances concurrency and reduces
lock overhead.
 It maintains the track of what to lock and how to lock.
 It makes easy to decide either to lock a data item or to unlock a data
item. This type of hierarchy can be graphically represented as a tree.
RECOVERY FROM TRANSACTION
FAILURES
 DBMS is a highly complex system with hundreds of transactions being
executed every second. The durability and robustness of a DBMS
depends on its complex architecture and its underlying hardware and
system software.
 If it fails or crashes amid transactions, it is expected that the system
would follow some sort of algorithm or techniques to recover lost data.
TRANSACTION FAILURE
 A transaction has to abort when it fails to execute or when it reaches a
point from where it can’t go any further. This is called transaction failure
where only a few transactions or processes are hurt.
 Reasons for a transaction failure could be −
 Logical errors − Where a transaction cannot complete because it has some
code error or any internal error condition.
 System errors − Where the database system itself terminates an active
transaction because the DBMS is not able to execute it, or it has to stop
because of some system condition. For example, in case of deadlock or
resource unavailability, the system aborts an active transaction.
CONT….
 System Crash
 There are problems − external to the system − that may cause the system
to stop abruptly and cause the system to crash. For example, interruptions
in power supply may cause the failure of underlying hardware or software
failure.
 Examples may include operating system errors.
 Disk Failure
 In early days of technology evolution, it was a common problem where
hard-disk drives or storage drives used to fail frequently.
 Disk failures include formation of bad sectors, unreachability to the disk,
disk head crash or any other failure, which destroys all or a part of disk
storage.
LOG BASED RECOVERY
 Log-based recovery is a technique used in database management
systems (DBMS) to recover a database to a consistent state in the event
of a failure or crash. It involves the use of transaction logs, which are
records of all the transactions performed on the database.
 In log-based recovery, the DBMS uses the transaction log to reconstruct
the database to a consistent state. The transaction log contains records
of all the changes made to the database, including updates, inserts, and
deletes. It also records information about each transaction, such as its
start and end times.
ADVANTAGES :
 Durability: The log file provides a reliable and durable way to recover data in case of
a failure. It ensures that no committed transaction is lost due to a system crash.
 Faster Recovery: Log-based recovery is usually faster compared to other recovery
techniques, as it only needs to replay the committed transactions from the log file to
recover the database.
 Incremental Backup: Log-based recovery allows for incremental backups. Instead of
taking a full backup of the database every time, only the changes made since the last
backup are stored in the log file.
 Reduces the chances of Data Corruption: Log-based recovery reduces the chances of
data corruption by ensuring that all transactions are properly committed or aborted
before they are written to the database.
DISADVANTAGES:
 Additional overhead: Maintaining the log file incurs an additional overhead
on the database system, which can reduce the performance of the system.
 Complexity: Log-based recovery is a complex process that requires careful
management and administration. If not managed properly, it can lead to
data inconsistencies or loss.
 Storage space: The log file can consume a significant amount of storage
space, especially in a database with a large number of transactions.
 Time-Consuming: The process of replaying the transactions from the log
file can be time-consuming, especially if there are a large number of
transactions to recover.
CHECKPOINTS
 A checkpoint is a process that saves the current state of the database to
disk. This includes all transactions that have been committed, as well as any
changes that have been made to the database but not yet committed. The
checkpoint process also includes a log of all transactions that have
occurred since the last checkpoint. This log is used to recover the database
in the event of a system failure or crash.
 When a checkpoint occurs, the DBMS will write a copy of the current state
of the database to disk. This is done to ensure that the database can be
recovered quickly in the event of a failure. The checkpoint process also
includes a log of all transactions that have occurred since the last
checkpoint. This log is used to recover the database in the event of a
system failure or crash.
TYPES OF CHECKPOINTS
 There are two main types of checkpoints −
 Automatic Checkpoints
 Automatic checkpoints occur at regular intervals, such as every hour or
every day. The interval can be configured by the database
administrator. Automatic checkpoints are useful for large databases that
are constantly being updated, as they ensure that the database can be
recovered quickly in the event of a failure.
 For example, in SQL Server, the default interval for automatic
checkpoints is every minute, but this can be configured to occur at
different intervals.
CONT…..
 Manual Checkpoints
 Manual checkpoints are triggered by the database administrator, rather
than occurring at regular intervals. Manual checkpoints are useful for
smaller databases that are updated less frequently, as they allow the
administrator to choose when the checkpoint occurs.
SHADOW PAGING
 Shadow paging is one of the techniques that is used to recover from
failure. We all know that recovery means to get back the information,
which is lost. It helps to maintain database consistency in case of
failure.
CONCEPT OF SHADOW PAGING
 Now let see the concept of shadow paging step by step −
 Step 1 − Page is a segment of memory. Page table is an index of pages. Each table entry
points to a page on the disk.
 Step 2 − Two page tables are used during the life of a transaction: the current page table
and the shadow page table. Shadow page table is a copy of the current page table.
 Step 3 − When a transaction starts, both the tables look identical, the current table is
updated for each write operation.
 Step 4 − The shadow page is never changed during the life of the transaction.
 Step 5 − When the current transaction is committed, the shadow page entry becomes a
copy of the current page table entry and the disk block with the old data is released.
 Step 6 − The shadow page table is stored in non-volatile memory. If the system crash
occurs, then the shadow page table is copied to the current page table.
ADVANTAGES
 The advantages of shadow paging are as follows −
 No need for log records.
 No undo/ Redo algorithm.
 Recovery is faster.
DISADVANTAGES
 The disadvantages of shadow paging are as follows −
 Data is fragmented or scattered.
 Garbage collection problem. Database pages containing old versions of
modified data need to be garbage collected after every transaction.
 Concurrent transactions are difficult to execute.
DEADLOCK HANDLING
 In a database management system (DBMS), a deadlock occurs when two or
more transactions are waiting for each other to release resources, such as
locks on database objects, that they need to complete their operations. As
a result, none of the transactions can proceed, leading to a situation where
they are stuck or “deadlocked.”
 Deadlocks can happen in multi-user environments when two or more
transactions are running concurrently and try to access the same data in a
different order. When this happens, one transaction may hold a lock on a
resource that another transaction needs, while the second transaction may
hold a lock on a resource that the first transaction needs. Both transactions
are then blocked, waiting for the other to release the resource they need.
CONT…..
 DBMSs often use various techniques to detect and resolve deadlocks
automatically. These techniques include timeout mechanisms, where a
transaction is forced to release its locks after a certain period of time,
and deadlock detection algorithms, which periodically scan the
transaction log for deadlock cycles and then choose a transaction to
abort to resolve the deadlock.
 It is also possible to prevent deadlocks by careful design of
transactions, such as always acquiring locks in the same order or
releasing locks as soon as possible. Proper design of the database
schema and application can also help to minimize the likelihood of
deadlocks
CONT…..
 In a database, a deadlock is an unwanted situation in which two or
more transactions are waiting indefinitely for one another to give up
locks. Deadlock is said to be one of the most feared complications in
DBMS as it brings the whole system to a Halt.
Example – let us understand the concept of Deadlock with an example
:
Suppose, Transaction T1 holds a lock on some rows in the Students
table and needs to update some rows in the Grades table.
Simultaneously, Transaction T2 holds locks on those very rows (Which
T1 needs to update) in the Grades table but needs to update the rows
in the Student table held by Transaction T1.
CONT…..
 Now, the main problem arises. Transaction T1 will wait for transaction
T2 to give up the lock, and similarly, transaction T2 will wait for
transaction T1 to give up the lock. As a consequence, All activity comes
to a halt and remains at a standstill forever unless the DBMS detects the
deadlock and aborts one of the transactions.
DEADLOCK IN DBMS
THANK YOU
Ad

More Related Content

What's hot (20)

Queue in C, Queue Real Life of Example
Queue in C, Queue Real Life of ExampleQueue in C, Queue Real Life of Example
Queue in C, Queue Real Life of Example
Hitesh Kumar
 
Concurrency control
Concurrency control Concurrency control
Concurrency control
Abdelrahman Almassry
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
Subhasish Pati
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
NagajothiN1
 
Normalization
NormalizationNormalization
Normalization
Wangu Thupa
 
Lower bound
Lower boundLower bound
Lower bound
Rajendran
 
Parsing LL(1), SLR, LR(1)
Parsing LL(1), SLR, LR(1)Parsing LL(1), SLR, LR(1)
Parsing LL(1), SLR, LR(1)
Nitin Mohan Sharma
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
Ashish K
 
8-Practice problems on operator precedence parser-24-05-2023.docx
8-Practice problems on operator precedence parser-24-05-2023.docx8-Practice problems on operator precedence parser-24-05-2023.docx
8-Practice problems on operator precedence parser-24-05-2023.docx
venkatapranaykumarGa
 
Shadow paging
Shadow pagingShadow paging
Shadow paging
GowriLatha1
 
Multiversion Concurrency Control Techniques
Multiversion Concurrency Control TechniquesMultiversion Concurrency Control Techniques
Multiversion Concurrency Control Techniques
Raj vardhan
 
Turing machine
Turing machineTuring machine
Turing machine
MuhammadSamranTanvee
 
Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3
Srimatre K
 
Lecture 11 semantic analysis 2
Lecture 11 semantic analysis 2Lecture 11 semantic analysis 2
Lecture 11 semantic analysis 2
Iffat Anjum
 
Chapter17
Chapter17Chapter17
Chapter17
gourab87
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
Jyothishmathi Institute of Technology and Science Karimnagar
 
Graph coloring problem
Graph coloring problemGraph coloring problem
Graph coloring problem
V.V.Vanniaperumal College for Women
 
physical and logical data independence
physical and logical data independencephysical and logical data independence
physical and logical data independence
apoorva_upadhyay
 
DS UNIT 1.pdf
DS UNIT 1.pdfDS UNIT 1.pdf
DS UNIT 1.pdf
SeethaDinesh
 
ch7-clean.ppt
ch7-clean.pptch7-clean.ppt
ch7-clean.ppt
RAJULKUMARSUTHAR
 

Similar to DBMS UNIT 4 (20)

Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
sumit_study
 
UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing Concepts
Raj vardhan
 
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERYTRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
Rohit Kumar
 
Dbms
DbmsDbms
Dbms
naresh sharma
 
Transaction Managment in database management systems.pptx
Transaction Managment in database management systems.pptxTransaction Managment in database management systems.pptx
Transaction Managment in database management systems.pptx
ధావన్ కుమార్
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
Nancy Gulati
 
DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
Mukesh Tekwani
 
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
TRANSACTION MANAGEMENT  PROCESSING DBMS(5)TRANSACTION MANAGEMENT  PROCESSING DBMS(5)
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
Karthik Rohan
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
Janagi Raman S
 
Transaction management
Transaction managementTransaction management
Transaction management
ArchanaMani2
 
24904 lecture11
24904 lecture1124904 lecture11
24904 lecture11
Universitas Bina Darma Palembang
 
chp13.pdf
chp13.pdfchp13.pdf
chp13.pdf
cscmsai54
 
Dbms voc 5 unit
Dbms voc 5 unitDbms voc 5 unit
Dbms voc 5 unit
gurjotkawatra
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theory
Zainab Almugbel
 
DBMS-Module - 5 updated1onestructure of database.pptx
DBMS-Module - 5  updated1onestructure of database.pptxDBMS-Module - 5  updated1onestructure of database.pptx
DBMS-Module - 5 updated1onestructure of database.pptx
sureshm491823
 
TRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties Serializability
TRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties SerializabilityTRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties Serializability
TRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties Serializability
saranyaksr92
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Koteswari Kasireddy
 
Acid Properties In Database Management System
Acid Properties In Database Management SystemAcid Properties In Database Management System
Acid Properties In Database Management System
Ashish Kumar
 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
arnold 7490
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
sumit_study
 
UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing Concepts
Raj vardhan
 
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERYTRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
Rohit Kumar
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
Nancy Gulati
 
DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
Mukesh Tekwani
 
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
TRANSACTION MANAGEMENT  PROCESSING DBMS(5)TRANSACTION MANAGEMENT  PROCESSING DBMS(5)
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
Karthik Rohan
 
Transaction management
Transaction managementTransaction management
Transaction management
ArchanaMani2
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theory
Zainab Almugbel
 
DBMS-Module - 5 updated1onestructure of database.pptx
DBMS-Module - 5  updated1onestructure of database.pptxDBMS-Module - 5  updated1onestructure of database.pptx
DBMS-Module - 5 updated1onestructure of database.pptx
sureshm491823
 
TRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties Serializability
TRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties SerializabilityTRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties Serializability
TRANSACATION CONCEPTS ACID PNeed for Concurrencyroperties Serializability
saranyaksr92
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Koteswari Kasireddy
 
Acid Properties In Database Management System
Acid Properties In Database Management SystemAcid Properties In Database Management System
Acid Properties In Database Management System
Ashish Kumar
 
Ad

More from Dr. SURBHI SAROHA (20)

Deep learning(UNIT 3) BY Ms SURBHI SAROHA
Deep learning(UNIT 3) BY Ms SURBHI SAROHADeep learning(UNIT 3) BY Ms SURBHI SAROHA
Deep learning(UNIT 3) BY Ms SURBHI SAROHA
Dr. SURBHI SAROHA
 
MOBILE COMPUTING UNIT 2 by surbhi saroha
MOBILE COMPUTING UNIT 2 by surbhi sarohaMOBILE COMPUTING UNIT 2 by surbhi saroha
MOBILE COMPUTING UNIT 2 by surbhi saroha
Dr. SURBHI SAROHA
 
Mobile Computing UNIT 1 by surbhi saroha
Mobile Computing UNIT 1 by surbhi sarohaMobile Computing UNIT 1 by surbhi saroha
Mobile Computing UNIT 1 by surbhi saroha
Dr. SURBHI SAROHA
 
DEEP LEARNING (UNIT 2 ) by surbhi saroha
DEEP LEARNING (UNIT 2 ) by surbhi sarohaDEEP LEARNING (UNIT 2 ) by surbhi saroha
DEEP LEARNING (UNIT 2 ) by surbhi saroha
Dr. SURBHI SAROHA
 
Introduction to Deep Leaning(UNIT 1).pptx
Introduction to Deep Leaning(UNIT 1).pptxIntroduction to Deep Leaning(UNIT 1).pptx
Introduction to Deep Leaning(UNIT 1).pptx
Dr. SURBHI SAROHA
 
Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2
Dr. SURBHI SAROHA
 
Management Information System(Unit 2).pptx
Management Information System(Unit 2).pptxManagement Information System(Unit 2).pptx
Management Information System(Unit 2).pptx
Dr. SURBHI SAROHA
 
Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)
Dr. SURBHI SAROHA
 
Management Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptxManagement Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptx
Dr. SURBHI SAROHA
 
Introduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptxIntroduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptx
Dr. SURBHI SAROHA
 
JAVA (UNIT 5)
JAVA (UNIT 5)JAVA (UNIT 5)
JAVA (UNIT 5)
Dr. SURBHI SAROHA
 
DBMS (UNIT 5)
DBMS (UNIT 5)DBMS (UNIT 5)
DBMS (UNIT 5)
Dr. SURBHI SAROHA
 
JAVA(UNIT 4)
JAVA(UNIT 4)JAVA(UNIT 4)
JAVA(UNIT 4)
Dr. SURBHI SAROHA
 
OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)
Dr. SURBHI SAROHA
 
OOPS & C++(UNIT 4)
OOPS & C++(UNIT 4)OOPS & C++(UNIT 4)
OOPS & C++(UNIT 4)
Dr. SURBHI SAROHA
 
DBMS UNIT 3
DBMS UNIT 3DBMS UNIT 3
DBMS UNIT 3
Dr. SURBHI SAROHA
 
JAVA (UNIT 3)
JAVA (UNIT 3)JAVA (UNIT 3)
JAVA (UNIT 3)
Dr. SURBHI SAROHA
 
Keys in dbms(UNIT 2)
Keys in dbms(UNIT 2)Keys in dbms(UNIT 2)
Keys in dbms(UNIT 2)
Dr. SURBHI SAROHA
 
DBMS (UNIT 2)
DBMS (UNIT 2)DBMS (UNIT 2)
DBMS (UNIT 2)
Dr. SURBHI SAROHA
 
JAVA UNIT 2
JAVA UNIT 2JAVA UNIT 2
JAVA UNIT 2
Dr. SURBHI SAROHA
 
Deep learning(UNIT 3) BY Ms SURBHI SAROHA
Deep learning(UNIT 3) BY Ms SURBHI SAROHADeep learning(UNIT 3) BY Ms SURBHI SAROHA
Deep learning(UNIT 3) BY Ms SURBHI SAROHA
Dr. SURBHI SAROHA
 
MOBILE COMPUTING UNIT 2 by surbhi saroha
MOBILE COMPUTING UNIT 2 by surbhi sarohaMOBILE COMPUTING UNIT 2 by surbhi saroha
MOBILE COMPUTING UNIT 2 by surbhi saroha
Dr. SURBHI SAROHA
 
Mobile Computing UNIT 1 by surbhi saroha
Mobile Computing UNIT 1 by surbhi sarohaMobile Computing UNIT 1 by surbhi saroha
Mobile Computing UNIT 1 by surbhi saroha
Dr. SURBHI SAROHA
 
DEEP LEARNING (UNIT 2 ) by surbhi saroha
DEEP LEARNING (UNIT 2 ) by surbhi sarohaDEEP LEARNING (UNIT 2 ) by surbhi saroha
DEEP LEARNING (UNIT 2 ) by surbhi saroha
Dr. SURBHI SAROHA
 
Introduction to Deep Leaning(UNIT 1).pptx
Introduction to Deep Leaning(UNIT 1).pptxIntroduction to Deep Leaning(UNIT 1).pptx
Introduction to Deep Leaning(UNIT 1).pptx
Dr. SURBHI SAROHA
 
Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2
Dr. SURBHI SAROHA
 
Management Information System(Unit 2).pptx
Management Information System(Unit 2).pptxManagement Information System(Unit 2).pptx
Management Information System(Unit 2).pptx
Dr. SURBHI SAROHA
 
Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)
Dr. SURBHI SAROHA
 
Management Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptxManagement Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptx
Dr. SURBHI SAROHA
 
Introduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptxIntroduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptx
Dr. SURBHI SAROHA
 
Ad

Recently uploaded (20)

pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 

DBMS UNIT 4

  • 2. SYLLABUS  Transaction Processing  Transaction system  Testing of serializability  Recoverable schedule  Concurrency control  Locking techniques for concurrency control  Time stamping protocols for concurrency control  Validation based protocol  Multiple granularity  Recovery from transaction failures  Log based recovery  Checkpoints  Shadow paging  Deadlock handling
  • 3. TRANSACTION PROCESSING  The transaction is a set of logically related operation. It contains a group of tasks.  A transaction is an action or series of actions. It is performed by a single user to perform operations for accessing the contents of the database.  Example: Suppose an employee of bank transfers Rs 800 from X's account to Y's account. This small transaction contains several low-level tasks:
  • 4. X'S ACCOUNT  Open_Account(X)  Old_Balance = X.balance  New_Balance = Old_Balance - 800  X.balance = New_Balance  Close_Account(X)
  • 5. Y'S ACCOUNT  Open_Account(Y)  Old_Balance = Y.balance  New_Balance = Old_Balance + 800  Y.balance = New_Balance  Close_Account(Y)
  • 6. OPERATIONS OF TRANSACTION:  Following are the main operations of transaction:  Read(X): Read operation is used to read the value of X from the database and stores it in a buffer in main memory.  Write(X): Write operation is used to write the value back to the database from the buffer.  Let's take an example to debit transaction from an account which consists of following operations:  1. R(X);  2. X = X - 500;  3. W(X);
  • 7. CONT…..  Let's assume the value of X before starting of the transaction is 4000.  The first operation reads X's value from database and stores it in a buffer.  The second operation will decrease the value of X by 500. So buffer will contain 3500.  The third operation will write the buffer's value to the database. So X's final value will be 3500.  But it may be possible that because of the failure of hardware, software or power, etc. that transaction may fail before finished all the operations in the set.
  • 8. CONT….  For example: If in the above transaction, the debit transaction fails after executing operation 2 then X's value will remain 4000 in the database which is not acceptable by the bank.  To solve this problem, we have two important operations:  Commit: It is used to save the work done permanently.  Rollback: It is used to undo the work done. 
  • 9. ACID PROPERTIES  A transaction is a very small unit of a program and it may contain several lowlevel tasks. A transaction in a database system must maintain Atomicity, Consistency, Isolation, and Durability − commonly known as ACID properties − in order to ensure accuracy, completeness, and data integrity.
  • 10. CONT….  Atomicity − This property states that a transaction must be treated as an atomic unit, that is, either all of its operations are executed or none. There must be no state in a database where a transaction is left partially completed. States should be defined either before the execution of the transaction or after the execution/abortion/failure of the transaction.  Consistency − The database must remain in a consistent state after any transaction. No transaction should have any adverse effect on the data residing in the database. If the database was in a consistent state before the execution of a transaction, it must remain consistent after the execution of the transaction as well.
  • 11. CONT…..  Durability − The database should be durable enough to hold all its latest updates even if the system fails or restarts. If a transaction updates a chunk of data in a database and commits, then the database will hold the modified data. If a transaction commits but the system fails before the data could be written on to the disk, then that data will be updated once the system springs back into action.  Isolation − In a database system where more than one transaction are being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other transaction.
  • 12. TESTING OF SERIALIZABILITY  Serialization Graph is used to test the Serializability of a schedule.  Assume a schedule S. For S, we construct a graph known as precedence graph. This graph has a pair G = (V, E), where V consists a set of vertices, and E consists a set of edges. The set of vertices is used to contain all the transactions participating in the schedule. The set of edges is used to contain all edges Ti ->Tj for which one of the three conditions holds:  Create a node Ti → Tj if Ti executes write (Q) before Tj executes read (Q).  Create a node Ti → Tj if Ti executes read (Q) before Tj executes write (Q).  Create a node Ti → Tj if Ti executes write (Q) before Tj executes write (Q).
  • 13. If a precedence graph contains a single edge Ti → Tj, then all the instructions of Ti are executed before the first instruction of Tj is executed. If a precedence graph for schedule S contains a cycle, then S is non-serializable. If the precedence graph has no cycle, then S is known as serializable.
  • 14. RECOVERABLE SCHEDULE  Recoverability is a property of database systems that ensures that, in the event of a failure or error, the system can recover the database to a consistent state. Recoverability guarantees that all committed transactions are durable and that their effects are permanently stored in the database, while the effects of uncommitted transactions are undone to maintain data consistency.
  • 15. CONT…..  The recoverability property is enforced through the use of transaction logs, which record all changes made to the database during transaction processing. When a failure occurs, the system uses the log to recover the database to a consistent state, which involves either undoing the effects of uncommitted transactions or redoing the effects of committed transactions.
  • 16. THERE ARE SEVERAL LEVELS OF RECOVERABILITY THAT CAN BE SUPPORTED BY A DATABASE SYSTEM:  No-undo logging: This level of recoverability only guarantees that committed transactions are durable, but does not provide the ability to undo the effects of uncommitted transactions.  Undo logging: This level of recoverability provides the ability to undo the effects of uncommitted transactions but may result in the loss of updates made by committed transactions that occur after the failed transaction.
  • 17. CONT….  Redo logging: This level of recoverability provides the ability to redo the effects of committed transactions, ensuring that all committed updates are durable and can be recovered in the event of failure.  Undo-redo logging: This level of recoverability provides both undo and redo capabilities, ensuring that the system can recover to a consistent state regardless of whether a transaction has been committed or not.
  • 18. RECOVERABLE SCHEDULES:  Schedules in which transactions commit only after all transactions whose changes they read commit are called recoverable schedules. In other words, if some transaction Tj is reading value updated or written by some other transaction Ti, then the commit of Tj must occur after the commit of Ti.
  • 19. EXAMPLE : CONSIDER THE FOLLOWING SCHEDULE INVOLVING TWO TRANSACTIONS T1 AND T2. THIS IS A RECOVERABLE SCHEDULE SINCE T1 COMMITS BEFORE T2, THAT MAKES THE VALUE READ BY T2 CORRECT.
  • 20. CONCURRENCY CONTROL  Concurrently control is a very important concept of DBMS which ensures the simultaneous execution or manipulation of data by several processes or user without resulting in data inconsistency. Concurrency Control deals with interleaved execution of more than one transaction.  What is Transaction?  A set of logically related operations is known as a transaction. The main operations of a transaction are:  Read(A): Read operations Read(A) or R(A) reads the value of A from the database and stores it in a buffer in the main memory.  Write (A): Write operation Write(A) or W(A) writes the value back to the database from the buffer.
  • 21. CONCURRENCY CONTROL IN DBMS  Executing a single transaction at a time will increase the waiting time of the other transactions which may result in delay in the overall execution. Hence for increasing the overall throughput and efficiency of the system, several transactions are executed.  Concurrently control is a very important concept of DBMS which ensures the simultaneous execution or manipulation of data by several processes or user without resulting in data inconsistency.  Concurrency control provides a procedure that is able to control concurrent execution of the operations in the database.
  • 22. LOCKING TECHNIQUES FOR CONCURRENCY CONTROL  In a multiprogramming environment where multiple transactions can be executed simultaneously, it is highly important to control the concurrency of transactions. We have concurrency control protocols to ensure atomicity, isolation, and serializability of concurrent transactions. Concurrency control protocols can be broadly divided into two categories −  Lock based protocols  Time stamp based protocols
  • 23. LOCK-BASED PROTOCOLS  Database systems equipped with lock-based protocols use a mechanism by which any transaction cannot read or write data until it acquires an appropriate lock on it. Locks are of two kinds −  Binary Locks − A lock on a data item can be in two states; it is either locked or unlocked.  Shared/exclusive − This type of locking mechanism differentiates the locks based on their uses. If a lock is acquired on a data item to perform a write operation, it is an exclusive lock. Allowing more than one transaction to write on the same data item would lead the database into an inconsistent state. Read locks are shared because no data value is being changed.
  • 24. TWO-PHASE LOCKING 2PL  This locking protocol divides the execution phase of a transaction into three parts. In the first part, when the transaction starts executing, it seeks permission for the locks it requires.  The second part is where the transaction acquires all the locks. As soon as the transaction releases its first lock, the third phase starts.  In this phase, the transaction cannot demand any new locks; it only releases the acquired locks.
  • 26. CONT……  Two-phase locking has two phases, one is growing, where all the locks are being acquired by the transaction; and the second phase is shrinking, where the locks held by the transaction are being released.  To claim an exclusive (write) lock, a transaction must first acquire a shared (read) lock and then upgrade it to an exclusive lock.
  • 27. TIMESTAMP-BASED PROTOCOLS  The most commonly used concurrency protocol is the timestamp based protocol. This protocol uses either system time or logical counter as a timestamp.  Lock-based protocols manage the order between the conflicting pairs among transactions at the time of execution, whereas timestamp-based protocols start working as soon as a transaction is created.  Every transaction has a timestamp associated with it, and the ordering is determined by the age of the transaction. A transaction created at 0002 clock time would be older than all other transactions that come after it. For example, any transaction 'y' entering the system at 0004 is two seconds younger and the priority would be given to the older one.
  • 28. CONT….  In addition, every data item is given the latest read and write- timestamp. This lets the system know when the last ‘read and write’ operation was performed on the data item.
  • 29. VALIDATION BASED PROTOCOL  Validation Based Protocol is also called Optimistic Concurrency Control Technique. This protocol is used in DBMS (Database Management System) for avoiding concurrency in transactions. It is called optimistic because of the assumption it makes, i.e. very less interference occurs, therefore, there is no need for checking while the transaction is executed.
  • 30. CONT…..  In this technique, no checking is done while the transaction is been executed. Until the transaction end is reached updates in the transaction are not applied directly to the database. All updates are applied to local copies of data items kept for the transaction. At the end of transaction execution, while execution of the transaction, a validation phase checks whether any of transaction updates violate serializability. If there is no violation of serializability the transaction is committed and the database is updated; or else, the transaction is updated and then restarted.
  • 31. VALIDATION BASED PROTOCOL  Optimistic Concurrency Control is a three-phase protocol. The three phases for validation based protocol:  Read Phase: Values of committed data items from the database can be read by a transaction. Updates are only applied to local data versions.  Validation Phase: Checking is performed to make sure that there is no violation of serializability when the transaction updates are applied to the database.  Write Phase: On the success of the validation phase, the transaction updates are applied to the database, otherwise, the updates are discarded and the transaction is slowed down.
  • 32. ADVANTAGES:  1. Avoid Cascading-rollbacks: This validation based scheme avoid cascading rollbacks since the final write operations to the database are performed only after the transaction passes the validation phase. If the transaction fails then no updation operation is performed in the database. So no dirty read will happen hence possibilities cascading- rollback would be null.  2. Avoid deadlock: Since a strict time-stamping based technique is used to maintain the specific order of transactions. Hence deadlock isn’t possible in this scheme.
  • 33. DISADVANTAGES:  1. Starvation: There might be a possibility of starvation for long-term transactions, due to a sequence of conflicting short-term transactions that cause the repeated sequence of restarts of the long-term transactions so on and so forth. To avoid starvation, conflicting transactions must be temporarily blocked for some time, to let the long-term transactions to finish.
  • 34. MULTIPLE GRANULARITY  Granularity: It is the size of data item allowed to lock.  It can be defined as hierarchically breaking up the database into blocks which can be locked.  The Multiple Granularity protocol enhances concurrency and reduces lock overhead.  It maintains the track of what to lock and how to lock.  It makes easy to decide either to lock a data item or to unlock a data item. This type of hierarchy can be graphically represented as a tree.
  • 35. RECOVERY FROM TRANSACTION FAILURES  DBMS is a highly complex system with hundreds of transactions being executed every second. The durability and robustness of a DBMS depends on its complex architecture and its underlying hardware and system software.  If it fails or crashes amid transactions, it is expected that the system would follow some sort of algorithm or techniques to recover lost data.
  • 36. TRANSACTION FAILURE  A transaction has to abort when it fails to execute or when it reaches a point from where it can’t go any further. This is called transaction failure where only a few transactions or processes are hurt.  Reasons for a transaction failure could be −  Logical errors − Where a transaction cannot complete because it has some code error or any internal error condition.  System errors − Where the database system itself terminates an active transaction because the DBMS is not able to execute it, or it has to stop because of some system condition. For example, in case of deadlock or resource unavailability, the system aborts an active transaction.
  • 37. CONT….  System Crash  There are problems − external to the system − that may cause the system to stop abruptly and cause the system to crash. For example, interruptions in power supply may cause the failure of underlying hardware or software failure.  Examples may include operating system errors.  Disk Failure  In early days of technology evolution, it was a common problem where hard-disk drives or storage drives used to fail frequently.  Disk failures include formation of bad sectors, unreachability to the disk, disk head crash or any other failure, which destroys all or a part of disk storage.
  • 38. LOG BASED RECOVERY  Log-based recovery is a technique used in database management systems (DBMS) to recover a database to a consistent state in the event of a failure or crash. It involves the use of transaction logs, which are records of all the transactions performed on the database.  In log-based recovery, the DBMS uses the transaction log to reconstruct the database to a consistent state. The transaction log contains records of all the changes made to the database, including updates, inserts, and deletes. It also records information about each transaction, such as its start and end times.
  • 39. ADVANTAGES :  Durability: The log file provides a reliable and durable way to recover data in case of a failure. It ensures that no committed transaction is lost due to a system crash.  Faster Recovery: Log-based recovery is usually faster compared to other recovery techniques, as it only needs to replay the committed transactions from the log file to recover the database.  Incremental Backup: Log-based recovery allows for incremental backups. Instead of taking a full backup of the database every time, only the changes made since the last backup are stored in the log file.  Reduces the chances of Data Corruption: Log-based recovery reduces the chances of data corruption by ensuring that all transactions are properly committed or aborted before they are written to the database.
  • 40. DISADVANTAGES:  Additional overhead: Maintaining the log file incurs an additional overhead on the database system, which can reduce the performance of the system.  Complexity: Log-based recovery is a complex process that requires careful management and administration. If not managed properly, it can lead to data inconsistencies or loss.  Storage space: The log file can consume a significant amount of storage space, especially in a database with a large number of transactions.  Time-Consuming: The process of replaying the transactions from the log file can be time-consuming, especially if there are a large number of transactions to recover.
  • 41. CHECKPOINTS  A checkpoint is a process that saves the current state of the database to disk. This includes all transactions that have been committed, as well as any changes that have been made to the database but not yet committed. The checkpoint process also includes a log of all transactions that have occurred since the last checkpoint. This log is used to recover the database in the event of a system failure or crash.  When a checkpoint occurs, the DBMS will write a copy of the current state of the database to disk. This is done to ensure that the database can be recovered quickly in the event of a failure. The checkpoint process also includes a log of all transactions that have occurred since the last checkpoint. This log is used to recover the database in the event of a system failure or crash.
  • 42. TYPES OF CHECKPOINTS  There are two main types of checkpoints −  Automatic Checkpoints  Automatic checkpoints occur at regular intervals, such as every hour or every day. The interval can be configured by the database administrator. Automatic checkpoints are useful for large databases that are constantly being updated, as they ensure that the database can be recovered quickly in the event of a failure.  For example, in SQL Server, the default interval for automatic checkpoints is every minute, but this can be configured to occur at different intervals.
  • 43. CONT…..  Manual Checkpoints  Manual checkpoints are triggered by the database administrator, rather than occurring at regular intervals. Manual checkpoints are useful for smaller databases that are updated less frequently, as they allow the administrator to choose when the checkpoint occurs.
  • 44. SHADOW PAGING  Shadow paging is one of the techniques that is used to recover from failure. We all know that recovery means to get back the information, which is lost. It helps to maintain database consistency in case of failure.
  • 45. CONCEPT OF SHADOW PAGING  Now let see the concept of shadow paging step by step −  Step 1 − Page is a segment of memory. Page table is an index of pages. Each table entry points to a page on the disk.  Step 2 − Two page tables are used during the life of a transaction: the current page table and the shadow page table. Shadow page table is a copy of the current page table.  Step 3 − When a transaction starts, both the tables look identical, the current table is updated for each write operation.  Step 4 − The shadow page is never changed during the life of the transaction.  Step 5 − When the current transaction is committed, the shadow page entry becomes a copy of the current page table entry and the disk block with the old data is released.  Step 6 − The shadow page table is stored in non-volatile memory. If the system crash occurs, then the shadow page table is copied to the current page table.
  • 46. ADVANTAGES  The advantages of shadow paging are as follows −  No need for log records.  No undo/ Redo algorithm.  Recovery is faster.
  • 47. DISADVANTAGES  The disadvantages of shadow paging are as follows −  Data is fragmented or scattered.  Garbage collection problem. Database pages containing old versions of modified data need to be garbage collected after every transaction.  Concurrent transactions are difficult to execute.
  • 48. DEADLOCK HANDLING  In a database management system (DBMS), a deadlock occurs when two or more transactions are waiting for each other to release resources, such as locks on database objects, that they need to complete their operations. As a result, none of the transactions can proceed, leading to a situation where they are stuck or “deadlocked.”  Deadlocks can happen in multi-user environments when two or more transactions are running concurrently and try to access the same data in a different order. When this happens, one transaction may hold a lock on a resource that another transaction needs, while the second transaction may hold a lock on a resource that the first transaction needs. Both transactions are then blocked, waiting for the other to release the resource they need.
  • 49. CONT…..  DBMSs often use various techniques to detect and resolve deadlocks automatically. These techniques include timeout mechanisms, where a transaction is forced to release its locks after a certain period of time, and deadlock detection algorithms, which periodically scan the transaction log for deadlock cycles and then choose a transaction to abort to resolve the deadlock.  It is also possible to prevent deadlocks by careful design of transactions, such as always acquiring locks in the same order or releasing locks as soon as possible. Proper design of the database schema and application can also help to minimize the likelihood of deadlocks
  • 50. CONT…..  In a database, a deadlock is an unwanted situation in which two or more transactions are waiting indefinitely for one another to give up locks. Deadlock is said to be one of the most feared complications in DBMS as it brings the whole system to a Halt. Example – let us understand the concept of Deadlock with an example : Suppose, Transaction T1 holds a lock on some rows in the Students table and needs to update some rows in the Grades table. Simultaneously, Transaction T2 holds locks on those very rows (Which T1 needs to update) in the Grades table but needs to update the rows in the Student table held by Transaction T1.
  • 51. CONT…..  Now, the main problem arises. Transaction T1 will wait for transaction T2 to give up the lock, and similarly, transaction T2 will wait for transaction T1 to give up the lock. As a consequence, All activity comes to a halt and remains at a standstill forever unless the DBMS detects the deadlock and aborts one of the transactions.