SlideShare a Scribd company logo
Name Zahid Hussain
Roll no. 16717
Subject DBMS
Topic Concurrency & Distributed DBMS
Overview
1. Transaction
2. Concurrency
3. Resource locking
4. Deadlock
5. Types of Distributed DBMS
1.1 Transaction
logical unit of work it consist of one or more operations that must be completed
together.It either be successfully complete or fail.
1.1.1 Commit
A transaction is committed if it is completely successful and makes changes in
data.
1.1.2 Rollback
if transaction failed and leave the data unchanged it is said the data has rolled
back.
1.2 Transaction properties(ACID properties)
1.2.1 Atomicity
A transaction must completely succeed or completely fail. If any statement fail
the entire transaction fails completely.
1.2.2 Consistency
After completion the transaction leaves the data in a consistent state. For example
money should never be “created “ or “deleted” without an deposit or withdrawal.
1.2.3 Isolation
All transactions that modify the data are isolated from each other. A modifying
transaction can access the data only after the completion of other transaction
1.2.4 Durability
Durability means that the modifications made by a transaction are permanent
and persistent.
1.3 Concurrency
Concurrency is a situation in which two users access the same piece of data at
the same time. It occurs very commonly but sometimes create some problems.
1.3.1 Lost update problem
Problem arises when two or more transactions update the same data. Each
transaction unaware of other transactions . The last update overwrites.
TIME TEAM A STOCK TABLE TEAM B
9:00 Qty=100
10:30 Retrieve Qty
Qty=100
Retrieve Qty
Qty=100
10:31 Update=Qty-90
10:32 Qty=10
10:33 Update=Qty+30
Qty=130
1.3.2. Uncommitted Dependency Problem
In above example team B update the quantity 100 to 150
at time T1 and team A retrieve this update value at t2.Team
B rollbacks the action while making quantity 100 again .So,
the value of Team A becomes wrong at T3.
TIME TEAM A TEAM B
T1 - Update qty
T2 Retrieve qty -
T3 - Rollback
1.3.3 Inconsistent Analysis Problems
problem occurs when one transaction reading the several values from the
DB but another transaction update these some of them during the executing
of the first transaction.
TIME TEAM A TEAM B
T1 Retrieve acc-1:Sum=40 -
T2 Retrieve acc-2:Sum=90 -
T3 Retrieve acc-3
T4 Update acc-3=0
T5 Retrieve acc-1
T6 Update acc-1=50
T7 Commit
T8 Retrieve acc-3:Sum=90
Three accounts Acc-1:40 Acc-2: 50 Acc-3: 30
1.4 Resource locking
When a user access the data the second user has to wait until the first user
has finishes his work.
For example
USER 1 USER 2
1 Lock the item
2 retrieve the item
3 reduce item by 10
4 update the item
5 unlock the item
1 Lock the item
2 retrieve the item
3 reduce item by 10
4 update the item
5 unlock the item
Sequence of processing commands
by CPU
1 Lock the item user 1
2 retrieve the item user 1
3 lock the item for user 2.
already locked so user 2 has to wait
until user 1 unlock
4 reduce item by 10 for user 1
5 update the item for user 1
6 unlock the item for user 1
7 lock the item for user 2
8 retrieve item for user 2
9 reduce item by 20 for user 2
10 update the item for user 2
11 Unlock the item for user 2
1.4.1 Lock terminology
1. Implicit lock
Type of lock placed automatically by DBMS.
2. Explicit lock
Placed by application program by issuing a command.
3. Exclusive lock
Type of lock that locks item for any type of access no other can read or update.
4. Shared lock
Locks an item from change but not from read is called share lock.
5. Lock Granularity
The level of lock applied on an item is known as lock granularity
Levels
a. Row level(smallest lock granularity)
b. Page level
c. Table level
d. Database level(largest lock granularity)
5. Deadlock
Deadlock is a situation in which two transaction wait for completion of each
other.
USER 1 USER 2
1 Lock item A
2 Retrieve item A
3 Lock the item B
1 Lock item B
2 Retrieve item B
3 Lock the item A
Sequence processing by command in CPU
1 Lock the item A for user 1.
2 Lock the item B for user 2.
3 Retrieve A for user 1.
4 Retrieve item B for user 2.
5 Put user 1 in wait for user 2.
6 Put user 2 in wait for user 1
5.1 Solution of deadlock
1 Deadlock prevention
In this type users allow to issue only one lock request at a time.If user A and B
at once in the first line deadlock will not occurs.
2 Deadlock detection & recovery
If one transaction of user 2 is aborted then the item will be released from the lock
and the user 1 will be able to complete his work.
When a transaction is aborted then all changes made by that transaction should
be undone.
6. Types of Distributed DBMS
6.1 Homogeneous DDBMS
Means that the DB technology is the same or at least compatible to each .
It simplify the data sharing among different users.
Characteristics of Homogeneous DDBMS
i. Data distributed across all the nodes.
ii. The same DBMS used.
iii. All date manage by the DDBMS there is no exclusively local data.
iv. All users access the DB through database definition.
v. The global schema is the union of local DB schemas.
6.2 Heterogeneous DDBMS
Different DBMS used at each node. Much more difficult to manage.
Characteristics of Heterogeneous DDBMS
i. Data distributed across all the nodes.
ii. Different DBMS used at each location.
iii. A global schema exist which allow local user to access the data
iv. Some users require only local access to databases which cab be accomplished
using only local data DBMS and schema.
Any Question?
Thank you

More Related Content

PPT
Chapter 12 transactions and concurrency control
PDF
Database Consistency Models
PPTX
One step back, two steps forward
DOC
Newtons law review ps
PPT
Session 9 Tp9
DOCX
Intro to database systems homework questions- 1- List the ACID propert.docx
PPT
01-Description of the Transport Layer.ppt
Chapter 12 transactions and concurrency control
Database Consistency Models
One step back, two steps forward
Newtons law review ps
Session 9 Tp9
Intro to database systems homework questions- 1- List the ACID propert.docx
01-Description of the Transport Layer.ppt

Similar to transaction ,concurrency , and DDBMS (20)

PDF
DBMS-chap 2-Concurrency Control
PDF
Chapter 5 Database Transaction Management
PPTX
DBMS UNIT IV.pptx
PPTX
Welcome to the nightmare of locking, blocking and isolation levels!
PPTX
Lec 1-2 Relational Database Management Issues.pptx
PPTX
Understanding Transactions in Databases.pptx
PPT
Introduction to Transaction Management Overview.ppt
PPTX
DBMS Session 6 Transactions Management and Concurrency Control.pptx
PDF
Tybsc cs dbms2 notes
PPTX
Transaction management transparencies
PPTX
Dartabase Transaction.pptx
PPTX
Advanced DBMS presentation
PPT
Lec08
PPTX
DBMS Transaction course
PDF
The Nightmare of Locking, Blocking and Isolation Levels!
PPTX
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
PPTX
Multi version Concurrency Control and its applications in Advanced database s...
PPTX
Transactions in database systems and functions
PPT
CH09.ppt
PPTX
Managing Memory & Locks - Series 2 Transactions & Lock management
DBMS-chap 2-Concurrency Control
Chapter 5 Database Transaction Management
DBMS UNIT IV.pptx
Welcome to the nightmare of locking, blocking and isolation levels!
Lec 1-2 Relational Database Management Issues.pptx
Understanding Transactions in Databases.pptx
Introduction to Transaction Management Overview.ppt
DBMS Session 6 Transactions Management and Concurrency Control.pptx
Tybsc cs dbms2 notes
Transaction management transparencies
Dartabase Transaction.pptx
Advanced DBMS presentation
Lec08
DBMS Transaction course
The Nightmare of Locking, Blocking and Isolation Levels!
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
Multi version Concurrency Control and its applications in Advanced database s...
Transactions in database systems and functions
CH09.ppt
Managing Memory & Locks - Series 2 Transactions & Lock management
Ad

Recently uploaded (20)

PPTX
Virtual and Augmented Reality in Current Scenario
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
IGGE1 Understanding the Self1234567891011
PDF
My India Quiz Book_20210205121199924.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
Computer Architecture Input Output Memory.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
HVAC Specification 2024 according to central public works department
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Trump Administration's workforce development strategy
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
Virtual and Augmented Reality in Current Scenario
What if we spent less time fighting change, and more time building what’s rig...
IGGE1 Understanding the Self1234567891011
My India Quiz Book_20210205121199924.pdf
Hazard Identification & Risk Assessment .pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
Paper A Mock Exam 9_ Attempt review.pdf.
Computer Architecture Input Output Memory.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
HVAC Specification 2024 according to central public works department
Cambridge-Practice-Tests-for-IELTS-12.docx
History, Philosophy and sociology of education (1).pptx
Trump Administration's workforce development strategy
202450812 BayCHI UCSC-SV 20250812 v17.pptx
FORM 1 BIOLOGY MIND MAPS and their schemes
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Unit 4 Computer Architecture Multicore Processor.pptx
Ad

transaction ,concurrency , and DDBMS

  • 1. Name Zahid Hussain Roll no. 16717 Subject DBMS Topic Concurrency & Distributed DBMS
  • 2. Overview 1. Transaction 2. Concurrency 3. Resource locking 4. Deadlock 5. Types of Distributed DBMS
  • 3. 1.1 Transaction logical unit of work it consist of one or more operations that must be completed together.It either be successfully complete or fail. 1.1.1 Commit A transaction is committed if it is completely successful and makes changes in data. 1.1.2 Rollback if transaction failed and leave the data unchanged it is said the data has rolled back. 1.2 Transaction properties(ACID properties) 1.2.1 Atomicity A transaction must completely succeed or completely fail. If any statement fail the entire transaction fails completely. 1.2.2 Consistency After completion the transaction leaves the data in a consistent state. For example money should never be “created “ or “deleted” without an deposit or withdrawal.
  • 4. 1.2.3 Isolation All transactions that modify the data are isolated from each other. A modifying transaction can access the data only after the completion of other transaction 1.2.4 Durability Durability means that the modifications made by a transaction are permanent and persistent.
  • 5. 1.3 Concurrency Concurrency is a situation in which two users access the same piece of data at the same time. It occurs very commonly but sometimes create some problems. 1.3.1 Lost update problem Problem arises when two or more transactions update the same data. Each transaction unaware of other transactions . The last update overwrites. TIME TEAM A STOCK TABLE TEAM B 9:00 Qty=100 10:30 Retrieve Qty Qty=100 Retrieve Qty Qty=100 10:31 Update=Qty-90 10:32 Qty=10 10:33 Update=Qty+30 Qty=130
  • 6. 1.3.2. Uncommitted Dependency Problem In above example team B update the quantity 100 to 150 at time T1 and team A retrieve this update value at t2.Team B rollbacks the action while making quantity 100 again .So, the value of Team A becomes wrong at T3. TIME TEAM A TEAM B T1 - Update qty T2 Retrieve qty - T3 - Rollback
  • 7. 1.3.3 Inconsistent Analysis Problems problem occurs when one transaction reading the several values from the DB but another transaction update these some of them during the executing of the first transaction. TIME TEAM A TEAM B T1 Retrieve acc-1:Sum=40 - T2 Retrieve acc-2:Sum=90 - T3 Retrieve acc-3 T4 Update acc-3=0 T5 Retrieve acc-1 T6 Update acc-1=50 T7 Commit T8 Retrieve acc-3:Sum=90 Three accounts Acc-1:40 Acc-2: 50 Acc-3: 30
  • 8. 1.4 Resource locking When a user access the data the second user has to wait until the first user has finishes his work. For example USER 1 USER 2 1 Lock the item 2 retrieve the item 3 reduce item by 10 4 update the item 5 unlock the item 1 Lock the item 2 retrieve the item 3 reduce item by 10 4 update the item 5 unlock the item Sequence of processing commands by CPU 1 Lock the item user 1 2 retrieve the item user 1 3 lock the item for user 2. already locked so user 2 has to wait until user 1 unlock 4 reduce item by 10 for user 1 5 update the item for user 1 6 unlock the item for user 1 7 lock the item for user 2 8 retrieve item for user 2 9 reduce item by 20 for user 2 10 update the item for user 2 11 Unlock the item for user 2
  • 9. 1.4.1 Lock terminology 1. Implicit lock Type of lock placed automatically by DBMS. 2. Explicit lock Placed by application program by issuing a command. 3. Exclusive lock Type of lock that locks item for any type of access no other can read or update. 4. Shared lock Locks an item from change but not from read is called share lock. 5. Lock Granularity The level of lock applied on an item is known as lock granularity Levels a. Row level(smallest lock granularity) b. Page level c. Table level d. Database level(largest lock granularity)
  • 10. 5. Deadlock Deadlock is a situation in which two transaction wait for completion of each other. USER 1 USER 2 1 Lock item A 2 Retrieve item A 3 Lock the item B 1 Lock item B 2 Retrieve item B 3 Lock the item A Sequence processing by command in CPU 1 Lock the item A for user 1. 2 Lock the item B for user 2. 3 Retrieve A for user 1. 4 Retrieve item B for user 2. 5 Put user 1 in wait for user 2. 6 Put user 2 in wait for user 1
  • 11. 5.1 Solution of deadlock 1 Deadlock prevention In this type users allow to issue only one lock request at a time.If user A and B at once in the first line deadlock will not occurs. 2 Deadlock detection & recovery If one transaction of user 2 is aborted then the item will be released from the lock and the user 1 will be able to complete his work. When a transaction is aborted then all changes made by that transaction should be undone.
  • 12. 6. Types of Distributed DBMS 6.1 Homogeneous DDBMS Means that the DB technology is the same or at least compatible to each . It simplify the data sharing among different users. Characteristics of Homogeneous DDBMS i. Data distributed across all the nodes. ii. The same DBMS used. iii. All date manage by the DDBMS there is no exclusively local data. iv. All users access the DB through database definition. v. The global schema is the union of local DB schemas.
  • 13. 6.2 Heterogeneous DDBMS Different DBMS used at each node. Much more difficult to manage. Characteristics of Heterogeneous DDBMS i. Data distributed across all the nodes. ii. Different DBMS used at each location. iii. A global schema exist which allow local user to access the data iv. Some users require only local access to databases which cab be accomplished using only local data DBMS and schema.

Editor's Notes

  • #2: Name Zahid Hussain Roll no. 16717 Subject DBMS
  • #3: Main heading
  • #4: Subject
  • #5: Subject
  • #6: Subject
  • #7: Subject
  • #8: Subject
  • #9: Subject
  • #10: Subject
  • #11: Subject
  • #12: Subject
  • #13: Main heading
  • #14: Main heading
  • #15: Any Question
  • #16: Say thanks to me to make your time valuable