SlideShare a Scribd company logo
1 of 33
9/27/2020 1
Transaction Management:
Transaction concept & State
9/27/2020 2
Contents
 Transaction Concept
 Transaction State
 Implementation of Atomicity
and Durability
 Concurrent Executions
 Serializability
 Recoverability
9/27/2020 3
Transaction Concept
 A transaction is a unit of program / work
(collection of operations) execution that
accesses and possibly updates various data
items.
 A transaction must see a consistent database.
 During transaction execution the database may
be inconsistent.
 When the transaction is committed, the database
must be consistent.
 Two main issues to deal with:
 Failures of various kinds, such as hardware
failures and system crashes
 Concurrent execution of multiple
transactions
9/27/2020 4
Transaction properties or
ACID Properties
 Atomicity. Either all operations of the transaction are
properly reflected in the database or none are. To make
changes permanent, use COMMIT and to abort the changes,
use ROLLBACK.
Example : Transfer Rs 500 from account A to B
the system should ensure that updates of a partially executed transaction
are not reflected in the database
 Consistency. Execution of a transaction in isolation
preserves the consistency of the database. (database was in
consistent state before the transaction started and it must be in
consistent state after the termination of transaction. )
Example : sum of account A and B must be unchanged.
To preserve integrity of data, the database system must ensure
 Isolation. Although multiple
transactions may execute
concurrently, each transaction must
be unaware of other concurrently
executing transactions.
Intermediate transaction results
must be hidden from other
concurrently executed transactions
9/27/2020 5
9/27/2020 6
ACID Properties
Example:
 That is, for every pair of transactions Ti and Tj, it
appears to
Ti that either Tj, finished execution before Ti started, or
Tj started execution after Ti finished.
 Durability. once the user has been notified
that the transaction has completed
successfully, the changes it has made to the
database persist(remain) or permanent, even if
there are system failures.
9/27/2020 7
Example of Fund Transfer
 Transaction to transfer Rs.50 from account A to account B:
1. read(A)
2. A := A – 50
3. write(A)
4. read(B)
5. B := B + 50
6. write(B)
 Atomicity requirement — if the transaction fails after step 3
and before step 6, the system should ensure that its updates
are not reflected in the database, else an inconsistency will
result.
 Consistency requirement – the sum of A and B is unchanged
by the execution of the transaction.
9/27/2020 8
Example of Fund Transfer
(Cont.)
 Isolation requirement — if between steps 3 and 6, another
transaction is allowed to access the partially updated database,
it will see an inconsistent database
(the sum A + B will be less than it should be).
 Durability requirement — once the user has been notified that
the transaction has completed (i.e., the transfer of the Rs.50
has taken place), the updates to the database by the transaction
must persist despite failures.
 Can be ensured trivially by running transactions serially, that
is one after the other. However, executing multiple
transactions concurrently has significant benefits, as we will
see.
9/27/2020 9
Why Concurrency Control is
needed ?
 To overcome The Isolation
Problems
 Dirty read – Write read
 Unrepeatable – Read Write
 Lost update – Write write
9/27/2020 10
Dirty Read or Temporary Update
or Write Read Conflict
 Occurs when one transaction
updates a database item and
then the transaction fails for
some reason.
 The update item is accessed by
another transaction before it is
changed back to the original
value.
9/27/2020 11
Example:
Name Sal Dept
Marry 300 CSE
Scott 500 IT
John 1000 ECE
10 am : Start TX1
10.10 am: set mary’s
sal to 500
10.20 am : commit
10.15 am : Start TX2
10.16 am: read all sal
T1 T2
Write (X)
Commit
Read(X)
9/27/2020 12
Incorrect Summary Problem
 If one Tx is calculating an aggregate
summary function on a no of records
while other Tx are updating some of
these records,
 the aggregate function may calculate
some values before they are
updated
9/27/2020 13
Example:
Name Sal Dept
Marry 300 CSE
Scott 500 IT
John 1000 ECE
10 am : Start TX1
10.05 am: set mary’s
sal to 500
10.08 am : set scott’s
sal to 1000
10.06 am : Start TX2
10.07 am: sum all sal
(500+500+1000)
10.08 am: sum all sal
(500+1000+1000)
T1 T2
Write1(x)
Write1(x)
Write2(x)
Write2(x)
9/27/2020 14
Unrepeatable Read
 A Tx reads an item twice and
the item is changed by another
Tx1 between the two reads
9/27/2020 15
Example:
Name Sal Dept
Marry 300 CSE
Scott 500 IT
John 1000 ECE
10 am : Start TX1
10.05 am:read all sal
10.15 am :read all sal
10.06 am : Start TX2
10.07 am:set marys
Sal to 700
10.08 am : commit
T1 T2
read1 (x)
read1(x)
write2(x)
commit
9/27/2020 16
Repeatable Read (RW
conflict)
 only committed records to be
read, repeated reads of same
record must return same value.
However, a transaction may not
be serializable – it may find
some records inserted by a
transaction but not find other
data inserted by the same
transaction.
9/27/2020 17
Example:
Name Sal Dept
Marry 300 CSE
Scott 500 IT
John 1000 ECE
10 am : Start TX1
10.05 am:read all sal
10.15 am :read all sal
10.06 am : Start TX2
10.07 am:
insert (‘mira’,’600’,’HR’)
10.08 am : commit
T1 T2
read1 (x)
read1(x)
write2(x)
commit
9/27/2020 18
Unstable Cursor :
 A wants to something which is
deleted by B.
9/27/2020 19
Example:
Name Sal Dept
Marry 300 CSE
Scott 500 IT
John 1000 ECE
10 am : Start TX1
10.05 am:
set mary’s sal to 500
10.15 am :read all sal
10.10 am : Start TX2
10.11 am: drop sal
column
10.12 am : commit
T1 T2
write1(x)
9/27/2020 20
Lost Update Problem
 Occurs when two Tx’s access
the same database items have
their operations interleaved in a
way that makes the value of
some database items incorrect
9/27/2020 21
Example:
Name Sal Dept
Marry 300 CSE
Scott 500 IT
John 1000 ECE
10 am : Start TX1
10.10 am:
set mary’s sal to 500
10.11 am :commit
10.05 am : Start TX2
10.06 am: set mary’s
sal to 600
10.07 am : commit
T1 T2
Write1(x)
commit1
Write2(x)
commit2
9/27/2020 22
Transaction Model or
Transaction States
 Active, the initial state; the transaction stays in this state
while it is executing
 Partially committed, after the final statement has been
executed.
 Failed, after the discovery that normal execution can no
longer proceed.
 Aborted, after the transaction has been rolled back and the
database restored to its state prior to the start of the
transaction. Two options after it has been aborted:
 restart the transaction – only if no internal logical error
(it was aborted because of h/w and s/w error)
 kill the transaction: internal logical error. To correct it
re-write the application program.
 Committed, if its execution is successfully complete or
after successful completion.
9/27/2020 23
Transaction State (Cont.)
9/27/2020 24
Transaction Operations
 BEGIN Transaction
 READ or WRITE
 END Transaction
 COMMIT Transaction
 ROLLBACK (or ABORT)
9/27/2020 25
Implementation of Atomicity and
Durability
 The recovery-management component of a database system
implements the support for atomicity and durability.
 The shadow-database scheme:
 The scheme, which is based on making copies of the
database, called shadow copies
 assume that only one transaction is active at a time.
 a pointer called db_pointer always points to the current
consistent copy of the database.
 all updates are made on a shadow copy of the database, and
db_pointer is made to point to the updated shadow copy
only after the transaction reaches partial commit and all
updated pages have been flushed to disk.
 in case transaction fails, old consistent copy pointed to by
db_pointer can be used, and the shadow copy can be
deleted.
9/27/2020 26
Implementation of Atomicity and
Durability (Cont.)
 Assumes disks to not fail
 Useful for text editors, but extremely inefficient for large
databases: executing a single transaction requires copying the
entire database.
The shadow-database scheme:
9/27/2020 27
Concurrent Executions
 Multiple transactions are allowed to run concurrently in the
system. Advantages are:
 increased processor and disk utilization, leading to better
transaction throughput: one transaction can be using the
CPU while another is reading from or writing to the disk
 reduced average response time for transactions: short
transactions need not wait behind long ones.
 Concurrency control schemes – mechanisms to achieve
isolation, i.e., to control the interaction among the concurrent
transactions in order to prevent them from destroying the
consistency of the database
9/27/2020 28
Schedules
 Schedules – sequences that indicate the
chronological order in which instructions of
concurrent transactions are executed
 Or schedule is an order in which transactions
are executed in the system.
 Two types
 Serial schedule.
 Concurrent schedule.
 a schedule for a set of transactions must
consist of all instructions of those
transactions
 must preserve the order in which the
instructions appear in each individual
transaction.
9/27/2020 29
Example Schedules
 Let T1 transfer Rs. 50 from A to B, and T2 transfer
10% of the balance from A to B. The following is
a serial schedule (Schedule 1 in the text), in which
T1 is followed by T2.
9/27/2020 30
Example Schedule (Cont.)
 Let T1 and T2 be the transactions defined
previously. The following schedule (Schedule
3 in the text) is not a serial schedule, but it is
equivalent to Schedule 1.
In both Schedule 1 and 3, the sum A + B is preserved.
9/27/2020 31
Example Schedules (Cont.)
 The following concurrent schedule (Schedule 4 in
the text) does not preserve the value of the the
sum A + B.
Serializability of Schedule
 Concurrent schedule is
serializable or has serializability
property if its outcome is
equivalent to serial schedule.
 Serializability property of
schedule means its equivalent
to a serial schedule.
 Two types:
 Conflict serializability
 View serializability.
9/27/2020 32
Recoverability of schedule
 Serializability check whether the concurent
schedule is acceptable, assuming no
transaction failures.
 But failure can occur at any time.
 So schedule also needed to process
recoverability properties.
 Recoverability means transaction haven't
read the data written by aborted
transaction , and whose effect don't exist in
resulting database state.
9/27/2020 33

More Related Content

What's hot

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
3 phases in transactions 3 units
3 phases in transactions 3 units3 phases in transactions 3 units
3 phases in transactions 3 unitsavniS
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and propertiesChetan Mahawar
 
DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlMukesh Tekwani
 
CS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed CommitCS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed CommitJ Singh
 
David Weston SSIS Portfolio
David Weston SSIS PortfolioDavid Weston SSIS Portfolio
David Weston SSIS Portfoliodlweston
 
Optimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control AlgorithmOptimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control AlgorithmShounak Katyayan
 
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...Dr. Amarjeet Singh
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabadEdhole.com
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlbalamurugan.k Kalibalamurugan
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency ControlDilum Bandara
 

What's hot (16)

Transaction states PPT
Transaction states PPTTransaction states PPT
Transaction states PPT
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
3 phases in transactions 3 units
3 phases in transactions 3 units3 phases in transactions 3 units
3 phases in transactions 3 units
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
 
ARIES Recovery Algorithms
ARIES Recovery AlgorithmsARIES Recovery Algorithms
ARIES Recovery Algorithms
 
Recovery
RecoveryRecovery
Recovery
 
DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
 
CS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed CommitCS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed Commit
 
David Weston SSIS Portfolio
David Weston SSIS PortfolioDavid Weston SSIS Portfolio
David Weston SSIS Portfolio
 
Optimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control AlgorithmOptimistic Algorithm and Concurrency Control Algorithm
Optimistic Algorithm and Concurrency Control Algorithm
 
Aries
AriesAries
Aries
 
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabad
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
Ch15
Ch15Ch15
Ch15
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
 

Similar to transaction management, concept & State

DBMS Unit III Material
DBMS Unit III MaterialDBMS Unit III Material
DBMS Unit III MaterialArthyR3
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...DrCViji
 
1_Transaction.pdf
1_Transaction.pdf1_Transaction.pdf
1_Transaction.pdfNhtHong96
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
 
Introduction to transaction processing
Introduction to transaction processingIntroduction to transaction processing
Introduction to transaction processingJafar Nesargi
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingJafar Nesargi
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingJafar Nesargi
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011sumit_study
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-queryM Rezaur Rahman
 
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 RECOVERYRohit Kumar
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
TransactionsmanagementSanjeev Gupta
 
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Beat Signer
 
Transaction management
Transaction managementTransaction management
Transaction managementrenuka_a
 

Similar to transaction management, concept & State (20)

24904 lecture11
24904 lecture1124904 lecture11
24904 lecture11
 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
 
Ch15
Ch15Ch15
Ch15
 
Ch15 3717
Ch15 3717Ch15 3717
Ch15 3717
 
Ch15 3717
Ch15 3717Ch15 3717
Ch15 3717
 
Cs501 transaction
Cs501 transactionCs501 transaction
Cs501 transaction
 
DBMS Unit III Material
DBMS Unit III MaterialDBMS Unit III Material
DBMS Unit III Material
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
 
1_Transaction.pdf
1_Transaction.pdf1_Transaction.pdf
1_Transaction.pdf
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
Introduction to transaction processing
Introduction to transaction processingIntroduction to transaction processing
Introduction to transaction processing
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query
 
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
 
Ch15
Ch15Ch15
Ch15
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
 
Transaction management
Transaction managementTransaction management
Transaction management
 

More from Surya Swaroop

Pie chart - qualitative aptitude
Pie chart - qualitative aptitude Pie chart - qualitative aptitude
Pie chart - qualitative aptitude Surya Swaroop
 
Simplification and data interpretation table
Simplification and data interpretation tableSimplification and data interpretation table
Simplification and data interpretation tableSurya Swaroop
 
Quantitative aptitude table data interpretation
Quantitative aptitude  table data interpretationQuantitative aptitude  table data interpretation
Quantitative aptitude table data interpretationSurya Swaroop
 
Environmental engineering text book
Environmental engineering text bookEnvironmental engineering text book
Environmental engineering text bookSurya Swaroop
 
Development of surfaces
Development of surfacesDevelopment of surfaces
Development of surfacesSurya Swaroop
 
Design and Drawing of Steel Structures
Design and Drawing of Steel StructuresDesign and Drawing of Steel Structures
Design and Drawing of Steel StructuresSurya Swaroop
 
Design & Drawing of Steel Structures
 Design & Drawing of Steel Structures Design & Drawing of Steel Structures
Design & Drawing of Steel StructuresSurya Swaroop
 
design drawing of steel structures
design drawing of steel structuresdesign drawing of steel structures
design drawing of steel structuresSurya Swaroop
 
design-and-drawing Steel structures
design-and-drawing Steel structuresdesign-and-drawing Steel structures
design-and-drawing Steel structuresSurya Swaroop
 
design drawing steel structures
design drawing steel structuresdesign drawing steel structures
design drawing steel structuresSurya Swaroop
 
Integration material
Integration material Integration material
Integration material Surya Swaroop
 
deadlock and locking - dbms
deadlock and locking -  dbmsdeadlock and locking -  dbms
deadlock and locking - dbmsSurya Swaroop
 
relational algebra Tuple Relational Calculus - database management system
relational algebra Tuple Relational Calculus - database management systemrelational algebra Tuple Relational Calculus - database management system
relational algebra Tuple Relational Calculus - database management systemSurya Swaroop
 

More from Surya Swaroop (20)

Pie chart - qualitative aptitude
Pie chart - qualitative aptitude Pie chart - qualitative aptitude
Pie chart - qualitative aptitude
 
Simplification and data interpretation table
Simplification and data interpretation tableSimplification and data interpretation table
Simplification and data interpretation table
 
Quantitative aptitude table data interpretation
Quantitative aptitude  table data interpretationQuantitative aptitude  table data interpretation
Quantitative aptitude table data interpretation
 
Environmental engineering text book
Environmental engineering text bookEnvironmental engineering text book
Environmental engineering text book
 
Development of surfaces
Development of surfacesDevelopment of surfaces
Development of surfaces
 
Elasticity
ElasticityElasticity
Elasticity
 
Design and Drawing of Steel Structures
Design and Drawing of Steel StructuresDesign and Drawing of Steel Structures
Design and Drawing of Steel Structures
 
Design & Drawing of Steel Structures
 Design & Drawing of Steel Structures Design & Drawing of Steel Structures
Design & Drawing of Steel Structures
 
design drawing of steel structures
design drawing of steel structuresdesign drawing of steel structures
design drawing of steel structures
 
design-and-drawing Steel structures
design-and-drawing Steel structuresdesign-and-drawing Steel structures
design-and-drawing Steel structures
 
design drawing steel structures
design drawing steel structuresdesign drawing steel structures
design drawing steel structures
 
Integration material
Integration material Integration material
Integration material
 
Probability
ProbabilityProbability
Probability
 
Other transform dip
Other transform dipOther transform dip
Other transform dip
 
deadlock and locking - dbms
deadlock and locking -  dbmsdeadlock and locking -  dbms
deadlock and locking - dbms
 
relational algebra Tuple Relational Calculus - database management system
relational algebra Tuple Relational Calculus - database management systemrelational algebra Tuple Relational Calculus - database management system
relational algebra Tuple Relational Calculus - database management system
 
relational database
relational databaserelational database
relational database
 
er question dbms
er question dbmser question dbms
er question dbms
 
dbms er model
dbms er modeldbms er model
dbms er model
 
data base
data basedata base
data base
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

transaction management, concept & State

  • 2. 9/27/2020 2 Contents  Transaction Concept  Transaction State  Implementation of Atomicity and Durability  Concurrent Executions  Serializability  Recoverability
  • 3. 9/27/2020 3 Transaction Concept  A transaction is a unit of program / work (collection of operations) execution that accesses and possibly updates various data items.  A transaction must see a consistent database.  During transaction execution the database may be inconsistent.  When the transaction is committed, the database must be consistent.  Two main issues to deal with:  Failures of various kinds, such as hardware failures and system crashes  Concurrent execution of multiple transactions
  • 4. 9/27/2020 4 Transaction properties or ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are. To make changes permanent, use COMMIT and to abort the changes, use ROLLBACK. Example : Transfer Rs 500 from account A to B the system should ensure that updates of a partially executed transaction are not reflected in the database  Consistency. Execution of a transaction in isolation preserves the consistency of the database. (database was in consistent state before the transaction started and it must be in consistent state after the termination of transaction. ) Example : sum of account A and B must be unchanged. To preserve integrity of data, the database system must ensure
  • 5.  Isolation. Although multiple transactions may execute concurrently, each transaction must be unaware of other concurrently executing transactions. Intermediate transaction results must be hidden from other concurrently executed transactions 9/27/2020 5
  • 6. 9/27/2020 6 ACID Properties Example:  That is, for every pair of transactions Ti and Tj, it appears to Ti that either Tj, finished execution before Ti started, or Tj started execution after Ti finished.  Durability. once the user has been notified that the transaction has completed successfully, the changes it has made to the database persist(remain) or permanent, even if there are system failures.
  • 7. 9/27/2020 7 Example of Fund Transfer  Transaction to transfer Rs.50 from account A to account B: 1. read(A) 2. A := A – 50 3. write(A) 4. read(B) 5. B := B + 50 6. write(B)  Atomicity requirement — if the transaction fails after step 3 and before step 6, the system should ensure that its updates are not reflected in the database, else an inconsistency will result.  Consistency requirement – the sum of A and B is unchanged by the execution of the transaction.
  • 8. 9/27/2020 8 Example of Fund Transfer (Cont.)  Isolation requirement — if between steps 3 and 6, another transaction is allowed to access the partially updated database, it will see an inconsistent database (the sum A + B will be less than it should be).  Durability requirement — once the user has been notified that the transaction has completed (i.e., the transfer of the Rs.50 has taken place), the updates to the database by the transaction must persist despite failures.  Can be ensured trivially by running transactions serially, that is one after the other. However, executing multiple transactions concurrently has significant benefits, as we will see.
  • 9. 9/27/2020 9 Why Concurrency Control is needed ?  To overcome The Isolation Problems  Dirty read – Write read  Unrepeatable – Read Write  Lost update – Write write
  • 10. 9/27/2020 10 Dirty Read or Temporary Update or Write Read Conflict  Occurs when one transaction updates a database item and then the transaction fails for some reason.  The update item is accessed by another transaction before it is changed back to the original value.
  • 11. 9/27/2020 11 Example: Name Sal Dept Marry 300 CSE Scott 500 IT John 1000 ECE 10 am : Start TX1 10.10 am: set mary’s sal to 500 10.20 am : commit 10.15 am : Start TX2 10.16 am: read all sal T1 T2 Write (X) Commit Read(X)
  • 12. 9/27/2020 12 Incorrect Summary Problem  If one Tx is calculating an aggregate summary function on a no of records while other Tx are updating some of these records,  the aggregate function may calculate some values before they are updated
  • 13. 9/27/2020 13 Example: Name Sal Dept Marry 300 CSE Scott 500 IT John 1000 ECE 10 am : Start TX1 10.05 am: set mary’s sal to 500 10.08 am : set scott’s sal to 1000 10.06 am : Start TX2 10.07 am: sum all sal (500+500+1000) 10.08 am: sum all sal (500+1000+1000) T1 T2 Write1(x) Write1(x) Write2(x) Write2(x)
  • 14. 9/27/2020 14 Unrepeatable Read  A Tx reads an item twice and the item is changed by another Tx1 between the two reads
  • 15. 9/27/2020 15 Example: Name Sal Dept Marry 300 CSE Scott 500 IT John 1000 ECE 10 am : Start TX1 10.05 am:read all sal 10.15 am :read all sal 10.06 am : Start TX2 10.07 am:set marys Sal to 700 10.08 am : commit T1 T2 read1 (x) read1(x) write2(x) commit
  • 16. 9/27/2020 16 Repeatable Read (RW conflict)  only committed records to be read, repeated reads of same record must return same value. However, a transaction may not be serializable – it may find some records inserted by a transaction but not find other data inserted by the same transaction.
  • 17. 9/27/2020 17 Example: Name Sal Dept Marry 300 CSE Scott 500 IT John 1000 ECE 10 am : Start TX1 10.05 am:read all sal 10.15 am :read all sal 10.06 am : Start TX2 10.07 am: insert (‘mira’,’600’,’HR’) 10.08 am : commit T1 T2 read1 (x) read1(x) write2(x) commit
  • 18. 9/27/2020 18 Unstable Cursor :  A wants to something which is deleted by B.
  • 19. 9/27/2020 19 Example: Name Sal Dept Marry 300 CSE Scott 500 IT John 1000 ECE 10 am : Start TX1 10.05 am: set mary’s sal to 500 10.15 am :read all sal 10.10 am : Start TX2 10.11 am: drop sal column 10.12 am : commit T1 T2 write1(x)
  • 20. 9/27/2020 20 Lost Update Problem  Occurs when two Tx’s access the same database items have their operations interleaved in a way that makes the value of some database items incorrect
  • 21. 9/27/2020 21 Example: Name Sal Dept Marry 300 CSE Scott 500 IT John 1000 ECE 10 am : Start TX1 10.10 am: set mary’s sal to 500 10.11 am :commit 10.05 am : Start TX2 10.06 am: set mary’s sal to 600 10.07 am : commit T1 T2 Write1(x) commit1 Write2(x) commit2
  • 22. 9/27/2020 22 Transaction Model or Transaction States  Active, the initial state; the transaction stays in this state while it is executing  Partially committed, after the final statement has been executed.  Failed, after the discovery that normal execution can no longer proceed.  Aborted, after the transaction has been rolled back and the database restored to its state prior to the start of the transaction. Two options after it has been aborted:  restart the transaction – only if no internal logical error (it was aborted because of h/w and s/w error)  kill the transaction: internal logical error. To correct it re-write the application program.  Committed, if its execution is successfully complete or after successful completion.
  • 24. 9/27/2020 24 Transaction Operations  BEGIN Transaction  READ or WRITE  END Transaction  COMMIT Transaction  ROLLBACK (or ABORT)
  • 25. 9/27/2020 25 Implementation of Atomicity and Durability  The recovery-management component of a database system implements the support for atomicity and durability.  The shadow-database scheme:  The scheme, which is based on making copies of the database, called shadow copies  assume that only one transaction is active at a time.  a pointer called db_pointer always points to the current consistent copy of the database.  all updates are made on a shadow copy of the database, and db_pointer is made to point to the updated shadow copy only after the transaction reaches partial commit and all updated pages have been flushed to disk.  in case transaction fails, old consistent copy pointed to by db_pointer can be used, and the shadow copy can be deleted.
  • 26. 9/27/2020 26 Implementation of Atomicity and Durability (Cont.)  Assumes disks to not fail  Useful for text editors, but extremely inefficient for large databases: executing a single transaction requires copying the entire database. The shadow-database scheme:
  • 27. 9/27/2020 27 Concurrent Executions  Multiple transactions are allowed to run concurrently in the system. Advantages are:  increased processor and disk utilization, leading to better transaction throughput: one transaction can be using the CPU while another is reading from or writing to the disk  reduced average response time for transactions: short transactions need not wait behind long ones.  Concurrency control schemes – mechanisms to achieve isolation, i.e., to control the interaction among the concurrent transactions in order to prevent them from destroying the consistency of the database
  • 28. 9/27/2020 28 Schedules  Schedules – sequences that indicate the chronological order in which instructions of concurrent transactions are executed  Or schedule is an order in which transactions are executed in the system.  Two types  Serial schedule.  Concurrent schedule.  a schedule for a set of transactions must consist of all instructions of those transactions  must preserve the order in which the instructions appear in each individual transaction.
  • 29. 9/27/2020 29 Example Schedules  Let T1 transfer Rs. 50 from A to B, and T2 transfer 10% of the balance from A to B. The following is a serial schedule (Schedule 1 in the text), in which T1 is followed by T2.
  • 30. 9/27/2020 30 Example Schedule (Cont.)  Let T1 and T2 be the transactions defined previously. The following schedule (Schedule 3 in the text) is not a serial schedule, but it is equivalent to Schedule 1. In both Schedule 1 and 3, the sum A + B is preserved.
  • 31. 9/27/2020 31 Example Schedules (Cont.)  The following concurrent schedule (Schedule 4 in the text) does not preserve the value of the the sum A + B.
  • 32. Serializability of Schedule  Concurrent schedule is serializable or has serializability property if its outcome is equivalent to serial schedule.  Serializability property of schedule means its equivalent to a serial schedule.  Two types:  Conflict serializability  View serializability. 9/27/2020 32
  • 33. Recoverability of schedule  Serializability check whether the concurent schedule is acceptable, assuming no transaction failures.  But failure can occur at any time.  So schedule also needed to process recoverability properties.  Recoverability means transaction haven't read the data written by aborted transaction , and whose effect don't exist in resulting database state. 9/27/2020 33