SlideShare a Scribd company logo
- A n i l S h r e s t h a ( 0 7 0 / B C T / 0 1 )
- B i j a y S a h a n i ( 0 7 0 / B C T / 0 5 )
- B i m a l S h r e s t h a ( 0 7 0 / B C T / 1 0 )
- D e s h b h a k t a K h a n a l ( 0 7 0 / B C T / 1 3 )
17 March 2017
1
TRANSACTION &
CONCURRENCY CONTROL
What is a Transaction?
17 March 2017
2
 Logical unit of work in database
 An entire program
 A portion of program
 A single command
 Must be either entirely completed or aborted
 No intermediate steps are acceptable
 Successful transactions change database from one
consistent state to another
ACID Properties Of Transaction
17 March 2017
3
 Atomic – All or nothing
 All parts of transaction must be completed and committed or
must be aborted and rolled back
 Consistent
 Conducts transactions in serial order
 Important in multi-user and distributed databases
ACID Properties Of Transaction
17 March 2017
4
 Isolation
 There may be execution of multiple transaction and each
transaction must be unware of each other
 Durability
 Changes made to database persists even if there are system
failures
States Of Transaction
17 March 2017
5
 Active
 Partially Committed
 Committed
 Failed
 Aborted
Nested Transaction
17 March 2017
6
 A transaction that is created inside another
transaction
 While the nested (child) transaction is active, the
parent transaction may not perform any operations
other than to commit or abort, or to create more
child transactions
 When a parent aborts, all of its sub-transactions are
aborted
 When a sub-transaction aborts, parent can decide
whether to abort or not
Lock
17 March 2017
7
 A lock guarantees exclusive use of a data item to a
current transaction
 To access data item (lock acquire)
 After completion of transaction(release lock)
 All data item must be accessed in mutual
exclusive manner
Types of Lock
17 March 2017
8
 Shared lock
 Exclusive lock
Shared Lock
17 March 2017
9
 When we want read the data item value at that time
shared lock is used
 Lock-s
Exclusive Lock
17 March 2017
10
 It is used for both read and write
 Lock-x
Compatibility Between Lock Modes
17 March 2017
11
shared exclusive
shared true false
exclusive false false
Example of lock
17 March 2017
12
T1 T2
Lock-x(B)
R(B)
B-50
W(B)
Unlock(B)
lock-s(B)
R(B)
unlock(B)
Optimistic Concurrency Control
17 March 2017
13
 Optimistic concurrency control does not involve
locking rows when reading
 Optimistic concurrency control (OCC) helps
increase database performance
 Fewer resources are used to hold the locks during
the update process
 Records are locked for a shorter length of time
Method For Concurrent Control
17 March 2017
14
 Deadlock:
 A state in which each member of a group of transactions is
waiting for some other member to release a lock.
 Prevention:
Lock all the objects used by a transaction when it starts  not
a good way.
Method For Concurrent Control
17 March 2017
15
 Drawbacks of locking:
Lock maintenance represents an overhead that is not present in
systems that do not support concurrent access to shared data.
 Deadlock:
Deadlock prevention reduces concurrency
Method For Concurrent Control
17 March 2017
16
 Timestamp ordering:
 Each transaction is assigned a unique timestamp values
when it starts
 Timestamp defines its position in the time sequence of
transaction
Method For Concurrent Control
17 March 2017
17
 Timestamp ordering write rule:
if (Tc ≥ maximum read timestamp on D &&
Tc > write timestamp on committed version of D)
perform write operation on tentative version of D with write
timestamp Tc
else /*write is too late*/
abort transaction Tc
Method For Concurrent Control
17 March 2017
18
 Timestamp ordering read rule:
If (Tc> write timestamp on committed version of D)
{ let Dselected be the version of D with the maximum write
timestamp ≤ Tc
if (Dselected is committed)
perform read operation on the version Dselected
else
wait until the transaction that made version Dselected
commits or aborts then reapply the read rule
}
Else
abort transaction Tc
Method For Concurrent Control
17 March 2017
19
 Multi-version timestamp ordering:
 A list of old committed versions as well as tentative versions is
kept for each object.
 Read operations that arrive too late need not be rejected.

More Related Content

What's hot (20)

PPTX
Introduction to Unix
Nishant Munjal
 
PPT
Expert systems
Jithin Zcs
 
PPTX
File system structure
sangrampatil81
 
PPTX
Introduction to Parallel Computing
Roshan Karunarathna
 
PDF
Introduction to Firmware
Caroline Murphy
 
PPTX
Different types of operating systems
Mehul Jain
 
PPTX
Introduction to Operating Systems
Dr. C.V. Suresh Babu
 
PPTX
Introduction to Computers Lecture # 1
Sehrish Rafiq
 
PPTX
Introduction to Operating Systems
Damian T. Gordon
 
PPT
Computer System Organization
Kulachi Hansraj Model School Ashok Vihar
 
PDF
Operating System a Case Study
ijtsrd
 
PPTX
Operating Systems FYBSC IT UNIT I- Introduction to Operating Systems
Arti Parab Academics
 
PPT
Linux file system
Burhan Abbasi
 
DOCX
Green computing
RADHIKA GUPTA
 
PPTX
CPU Architecture - Basic
Yong Heui Cho
 
PPT
Aspect Oriented Software Development
Jignesh Patel
 
PPTX
Computer architecture
International Islamic University
 
PPT
Views on building blocks
Ritesh Khanna
 
PPTX
Operating Systems & Applications
Maulen Bale
 
PPTX
Processor types
Amr Aboelgood
 
Introduction to Unix
Nishant Munjal
 
Expert systems
Jithin Zcs
 
File system structure
sangrampatil81
 
Introduction to Parallel Computing
Roshan Karunarathna
 
Introduction to Firmware
Caroline Murphy
 
Different types of operating systems
Mehul Jain
 
Introduction to Operating Systems
Dr. C.V. Suresh Babu
 
Introduction to Computers Lecture # 1
Sehrish Rafiq
 
Introduction to Operating Systems
Damian T. Gordon
 
Computer System Organization
Kulachi Hansraj Model School Ashok Vihar
 
Operating System a Case Study
ijtsrd
 
Operating Systems FYBSC IT UNIT I- Introduction to Operating Systems
Arti Parab Academics
 
Linux file system
Burhan Abbasi
 
Green computing
RADHIKA GUPTA
 
CPU Architecture - Basic
Yong Heui Cho
 
Aspect Oriented Software Development
Jignesh Patel
 
Computer architecture
International Islamic University
 
Views on building blocks
Ritesh Khanna
 
Operating Systems & Applications
Maulen Bale
 
Processor types
Amr Aboelgood
 

Viewers also liked (20)

PPT
Locking unit 1 topic 3
avniS
 
PPT
Transaction concurrency control
Anand Grewal
 
PPTX
Solid Oxide Fuel Cells
Coalco New York
 
PPT
Transaction processing systems
greg robertson
 
PPT
16. Concurrency Control in DBMS
koolkampus
 
PPT
Databases: Concurrency Control
Damian T. Gordon
 
PPT
Concurrency control
Virender Kumar
 
PPTX
Data Models In Database Management System
Amad Ahmad
 
PPT
multi-threading
Ezzat Gul
 
PDF
Transactions and Concurrency Control Patterns
Vlad Mihalcea
 
PPTX
Distributed concurrency control
Binte fatima
 
PPT
Concurrency control ms neeti
neeti arora
 
PPTX
Edinburgh | May-16 | Energy Storage Technologies for Climate Change Mitigation
Smart Villages
 
PPTX
System Data Modelling Tools
Liam Dunphy
 
PPTX
Spoilage of meat
sudarshanna kar
 
PDF
Locking and Concurrency Control
Morgan Tocker
 
PPTX
data base management system
Akshit R Shah
 
PDF
Concurrency control
Jacob Zvirikuzhe
 
PPTX
Bio Fuels
Srinivasvasu1998
 
PPTX
protocols of concurrency control
MOHIT DADU
 
Locking unit 1 topic 3
avniS
 
Transaction concurrency control
Anand Grewal
 
Solid Oxide Fuel Cells
Coalco New York
 
Transaction processing systems
greg robertson
 
16. Concurrency Control in DBMS
koolkampus
 
Databases: Concurrency Control
Damian T. Gordon
 
Concurrency control
Virender Kumar
 
Data Models In Database Management System
Amad Ahmad
 
multi-threading
Ezzat Gul
 
Transactions and Concurrency Control Patterns
Vlad Mihalcea
 
Distributed concurrency control
Binte fatima
 
Concurrency control ms neeti
neeti arora
 
Edinburgh | May-16 | Energy Storage Technologies for Climate Change Mitigation
Smart Villages
 
System Data Modelling Tools
Liam Dunphy
 
Spoilage of meat
sudarshanna kar
 
Locking and Concurrency Control
Morgan Tocker
 
data base management system
Akshit R Shah
 
Concurrency control
Jacob Zvirikuzhe
 
Bio Fuels
Srinivasvasu1998
 
protocols of concurrency control
MOHIT DADU
 
Ad

Similar to Transaction and concurrency control (20)

PPT
These slides are about How to do The transaction.ppt
mforytb1
 
PPT
Svetlin Nakov - Database Transactions
Svetlin Nakov
 
PDF
Transaction Management, Concurrency Control and Deadlocks.pdf
beshahashenafe20
 
PPT
chapter 1 Transaction_Management_and_Concurrency_Control_all_lectures.ppt
tegenefikadu91
 
PPT
database management system Chapter 5
Mohamad Syazwan
 
PPT
transaction management, concept & State
Surya Swaroop
 
PPT
Transaction
azm13
 
PPTX
Transaction management transparencies
Mohamed Zeinelabdeen Abdelgader Farh jber
 
PPTX
Ch 9
muteddy
 
PDF
presentationprintTemp presentationorint.pdf
WabiTiki
 
PDF
Chapter 5 Database Transaction Management
Eddyzulham Mahluzydde
 
PPTX
DBMS Session 6 Transactions Management and Concurrency Control.pptx
kimwesther86
 
PPTX
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Gyanmanjari Institute Of Technology
 
PPTX
Transaction conccurency
Esraa Farrag
 
PPT
CH09.ppt
ssuser5c874e
 
DOCX
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
randyburney60861
 
PPT
Job Opportunity
Sunny Saini
 
PPTX
DBMS UNIT IV.pptx
Janagi Raman S
 
PPTX
Introduction to transaction processing concepts and theory
Zainab Almugbel
 
PPSX
Transactions and Concurrency control
jyoti_lakhani
 
These slides are about How to do The transaction.ppt
mforytb1
 
Svetlin Nakov - Database Transactions
Svetlin Nakov
 
Transaction Management, Concurrency Control and Deadlocks.pdf
beshahashenafe20
 
chapter 1 Transaction_Management_and_Concurrency_Control_all_lectures.ppt
tegenefikadu91
 
database management system Chapter 5
Mohamad Syazwan
 
transaction management, concept & State
Surya Swaroop
 
Transaction
azm13
 
Transaction management transparencies
Mohamed Zeinelabdeen Abdelgader Farh jber
 
Ch 9
muteddy
 
presentationprintTemp presentationorint.pdf
WabiTiki
 
Chapter 5 Database Transaction Management
Eddyzulham Mahluzydde
 
DBMS Session 6 Transactions Management and Concurrency Control.pptx
kimwesther86
 
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Gyanmanjari Institute Of Technology
 
Transaction conccurency
Esraa Farrag
 
CH09.ppt
ssuser5c874e
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
randyburney60861
 
Job Opportunity
Sunny Saini
 
DBMS UNIT IV.pptx
Janagi Raman S
 
Introduction to transaction processing concepts and theory
Zainab Almugbel
 
Transactions and Concurrency control
jyoti_lakhani
 
Ad

More from Anil Shrestha (8)

PDF
Syllabus for Internship.pdf
Anil Shrestha
 
PPTX
Tweet sentiment analysis (Data mining)
Anil Shrestha
 
DOCX
Tweet sentiment analysis
Anil Shrestha
 
PPTX
Real time-handwritten-devanagari-character-recoginition
Anil Shrestha
 
PPTX
Performance Evaluation of Employee
Anil Shrestha
 
DOCX
Stock Market Analysis and Prediction
Anil Shrestha
 
DOCX
Iris recognition system
Anil Shrestha
 
PPTX
Case study o & m
Anil Shrestha
 
Syllabus for Internship.pdf
Anil Shrestha
 
Tweet sentiment analysis (Data mining)
Anil Shrestha
 
Tweet sentiment analysis
Anil Shrestha
 
Real time-handwritten-devanagari-character-recoginition
Anil Shrestha
 
Performance Evaluation of Employee
Anil Shrestha
 
Stock Market Analysis and Prediction
Anil Shrestha
 
Iris recognition system
Anil Shrestha
 
Case study o & m
Anil Shrestha
 

Recently uploaded (20)

PPTX
ENG8 Q1, WEEK 4.pptxoooiioooooooooooooooooooooooooo
chubbychubz1
 
PPTX
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
PDF
mosfet introduction engg topic for students.pdf
trsureshkumardata
 
PDF
A presentation on the Urban Heat Island Effect
studyfor7hrs
 
PDF
Geothermal Heat Pump ppt-SHRESTH S KOKNE
SHRESTHKOKNE
 
PDF
Web Technologies - Chapter 3 of Front end path.pdf
reemaaliasker
 
PDF
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
PDF
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
PPT
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
PPTX
File Strucutres and Access in Data Structures
mwaslam2303
 
PPTX
Abstract Data Types (ADTs) in Data Structures
mwaslam2303
 
PDF
LEARNING CROSS-LINGUAL WORD EMBEDDINGS WITH UNIVERSAL CONCEPTS
kjim477n
 
PPT
IISM Presentation.ppt Construction safety
lovingrkn
 
PDF
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
PPT
Hazard identification and risk assessment PPT
SUNILARORA51
 
PDF
Natural Language processing and web deigning notes
AnithaSakthivel3
 
PPTX
Sensor IC System Design Using COMSOL Multiphysics 2025-July.pptx
James D.B. Wang, PhD
 
PPTX
00-ClimateChangeImpactCIAProcess_PPTon23.12.2024-ByDr.VijayanGurumurthyIyer1....
praz3
 
PPTX
Unit II: Meteorology of Air Pollution and Control Engineering:
sundharamm
 
PDF
Air -Powered Car PPT by ER. SHRESTH SUDHIR KOKNE.pdf
SHRESTHKOKNE
 
ENG8 Q1, WEEK 4.pptxoooiioooooooooooooooooooooooooo
chubbychubz1
 
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
mosfet introduction engg topic for students.pdf
trsureshkumardata
 
A presentation on the Urban Heat Island Effect
studyfor7hrs
 
Geothermal Heat Pump ppt-SHRESTH S KOKNE
SHRESTHKOKNE
 
Web Technologies - Chapter 3 of Front end path.pdf
reemaaliasker
 
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
File Strucutres and Access in Data Structures
mwaslam2303
 
Abstract Data Types (ADTs) in Data Structures
mwaslam2303
 
LEARNING CROSS-LINGUAL WORD EMBEDDINGS WITH UNIVERSAL CONCEPTS
kjim477n
 
IISM Presentation.ppt Construction safety
lovingrkn
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Hazard identification and risk assessment PPT
SUNILARORA51
 
Natural Language processing and web deigning notes
AnithaSakthivel3
 
Sensor IC System Design Using COMSOL Multiphysics 2025-July.pptx
James D.B. Wang, PhD
 
00-ClimateChangeImpactCIAProcess_PPTon23.12.2024-ByDr.VijayanGurumurthyIyer1....
praz3
 
Unit II: Meteorology of Air Pollution and Control Engineering:
sundharamm
 
Air -Powered Car PPT by ER. SHRESTH SUDHIR KOKNE.pdf
SHRESTHKOKNE
 

Transaction and concurrency control

  • 1. - A n i l S h r e s t h a ( 0 7 0 / B C T / 0 1 ) - B i j a y S a h a n i ( 0 7 0 / B C T / 0 5 ) - B i m a l S h r e s t h a ( 0 7 0 / B C T / 1 0 ) - D e s h b h a k t a K h a n a l ( 0 7 0 / B C T / 1 3 ) 17 March 2017 1 TRANSACTION & CONCURRENCY CONTROL
  • 2. What is a Transaction? 17 March 2017 2  Logical unit of work in database  An entire program  A portion of program  A single command  Must be either entirely completed or aborted  No intermediate steps are acceptable  Successful transactions change database from one consistent state to another
  • 3. ACID Properties Of Transaction 17 March 2017 3  Atomic – All or nothing  All parts of transaction must be completed and committed or must be aborted and rolled back  Consistent  Conducts transactions in serial order  Important in multi-user and distributed databases
  • 4. ACID Properties Of Transaction 17 March 2017 4  Isolation  There may be execution of multiple transaction and each transaction must be unware of each other  Durability  Changes made to database persists even if there are system failures
  • 5. States Of Transaction 17 March 2017 5  Active  Partially Committed  Committed  Failed  Aborted
  • 6. Nested Transaction 17 March 2017 6  A transaction that is created inside another transaction  While the nested (child) transaction is active, the parent transaction may not perform any operations other than to commit or abort, or to create more child transactions  When a parent aborts, all of its sub-transactions are aborted  When a sub-transaction aborts, parent can decide whether to abort or not
  • 7. Lock 17 March 2017 7  A lock guarantees exclusive use of a data item to a current transaction  To access data item (lock acquire)  After completion of transaction(release lock)  All data item must be accessed in mutual exclusive manner
  • 8. Types of Lock 17 March 2017 8  Shared lock  Exclusive lock
  • 9. Shared Lock 17 March 2017 9  When we want read the data item value at that time shared lock is used  Lock-s
  • 10. Exclusive Lock 17 March 2017 10  It is used for both read and write  Lock-x
  • 11. Compatibility Between Lock Modes 17 March 2017 11 shared exclusive shared true false exclusive false false
  • 12. Example of lock 17 March 2017 12 T1 T2 Lock-x(B) R(B) B-50 W(B) Unlock(B) lock-s(B) R(B) unlock(B)
  • 13. Optimistic Concurrency Control 17 March 2017 13  Optimistic concurrency control does not involve locking rows when reading  Optimistic concurrency control (OCC) helps increase database performance  Fewer resources are used to hold the locks during the update process  Records are locked for a shorter length of time
  • 14. Method For Concurrent Control 17 March 2017 14  Deadlock:  A state in which each member of a group of transactions is waiting for some other member to release a lock.  Prevention: Lock all the objects used by a transaction when it starts  not a good way.
  • 15. Method For Concurrent Control 17 March 2017 15  Drawbacks of locking: Lock maintenance represents an overhead that is not present in systems that do not support concurrent access to shared data.  Deadlock: Deadlock prevention reduces concurrency
  • 16. Method For Concurrent Control 17 March 2017 16  Timestamp ordering:  Each transaction is assigned a unique timestamp values when it starts  Timestamp defines its position in the time sequence of transaction
  • 17. Method For Concurrent Control 17 March 2017 17  Timestamp ordering write rule: if (Tc ≥ maximum read timestamp on D && Tc > write timestamp on committed version of D) perform write operation on tentative version of D with write timestamp Tc else /*write is too late*/ abort transaction Tc
  • 18. Method For Concurrent Control 17 March 2017 18  Timestamp ordering read rule: If (Tc> write timestamp on committed version of D) { let Dselected be the version of D with the maximum write timestamp ≤ Tc if (Dselected is committed) perform read operation on the version Dselected else wait until the transaction that made version Dselected commits or aborts then reapply the read rule } Else abort transaction Tc
  • 19. Method For Concurrent Control 17 March 2017 19  Multi-version timestamp ordering:  A list of old committed versions as well as tentative versions is kept for each object.  Read operations that arrive too late need not be rejected.