SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
MCA, MSc(CS), PGDCA
Pratibha Rashmi
 When many people try to make modifications
to a database at any point of time, there
should be a system of controls in place to
ensure that changes made by one do not
adversely affect the other, this is calledadversely affect the other, this is called
concurrency control.
 Concurrency control deals with interleaved
execution of more than one transaction.
 When multiple transactions execute
concurrently in an uncontrolled or
unrestricted manner, then it might lead to
several problems. Such problems are called
as concurrency problems.
concurrency problems
In transaction
Dirty Read Problem
Unrepeatable Read Problem
Phantom Read Problem
Lost Update Problem
The concurrency problems are:-
 Dirty Read Problem
 Unrepeatable Read Problem
 Phantom Read Problem
 Lost Update Problem
 Dirty Read: Reading the data written by an
uncommitted transaction is called as dirty
read.
This read is called as dirty read because-
There is always a chance that the There is always a chance that the
uncommitted transaction might roll back
later.
 Thus, uncommitted transaction might make
other transactions read a value that does not
even exist.
 This leads to inconsistency of the database.
 Dirty read does not lead to inconsistency always.
 It becomes problematic only when the
uncommitted transaction fails and roll backs
later due to some reason.later due to some reason.
 Here,
T1 reads the value of A.
T1 updates the value of A in the buffer.
T2 reads the value of A from the buffer.
T2 writes the updated the value of A.
T2 commits.T2 commits.
T1 fails in later stages and rolls back.
 In this example,
1. T2 reads the dirty value of A written by the
uncommitted transaction T1.
2. T1 fails in later stages and roll backs.
3. Thus, the value that T2 read now stands to be
incorrect.
4. Therefore, database becomes inconsistent.
 This problem occurs when a transaction gets
to read unrepeated i.e. different values of
the same variable in its different read
operations even when it has not updated its
value.value.
 Here,
T1 reads the value of X (= 10 say).
T2 reads the value of X (= 10).
T1 updates the value of X (from 10 to 15 say)
in the buffer.
T2 again reads the value of X (but = 15).
 In this example,
1. T2 gets to read a different value of X in its second
reading.
2. T2 wonders how the value of X got changed
because according to it, it is running in isolation.
 This problem occurs when a transaction
reads some variable from the buffer and
when it reads the same variable later, it finds
that the variable does not exist.
 Here,
T1 reads X.
T2 reads X.
T1 deletes X.
T2 tries reading X but does not find it.T2 tries reading X but does not find it.
 In this example,
1. T2 finds that there does not exist any variable X
when it tries reading X again.
2. T2 wonders who deleted the variable X because
according to it, it is running in isolation.
 This problem occurs when multiple
transactions execute concurrently and
updates from one or more transactions get
lost.
 Here,
T1 reads the value of A (= 10 say).
T2 updates the value to A (= 15 say) in the buffer.
T2 does blind write A = 25 (write without read) in the
buffer.
T2 commits.
When T1 commits, it writes A = 25 in the database.
 In this example, In this example,
1. T1 writes the over written value of X in the database.
2. Thus, update from T1 gets lost.
NOTE-
 This problem occurs whenever there is a write-write conflict.
 In write-write conflict, there are two writes one by each
transaction on the same data item without any read in the
middle.
 To ensure consistency of the database, it is
very important to prevent the occurrence of
above problems.
 Concurrency Control Protocols help to
prevent the occurrence of above problemsprevent the occurrence of above problems
and maintain the consistency of the
database.
 If the transaction is rolled back, all the
database changes made inside the
transaction are ___________
A. made permanent
B. made temporary
C. copied to the logC. copied to the log
D. undone
 In ________ one transaction overwrites the
changes of another transaction.
A. uncommitted read problem
B. lost update problem
C. update lost problem
D. dirty read problem
 In a dirty read problem _________
A. one transaction reads an uncommitted value of another
transaction
B. one transaction reads the committed value for another
transaction
C. one transaction reads another transaction
D. one transaction commits another transaction.
C. one transaction reads another transaction
D. one transaction commits another transaction.
 Isolation of the transactions is ensured by
A. Transaction management
B. Application programmer
C. Concurrency control
D. Recovery management
 Define the term Concurrency Control.
 What is dirty read and phantom read?
 What is inconsistent read problem?
 What is the mean of write- write problem?
Reference: https://www.gatevidyalay.com/, http://beginnersbook.com
Concurrency control

Mais conteúdo relacionado

Mais procurados

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
koolkampus
 

Mais procurados (20)

Data Link Layer Numericals
Data Link Layer NumericalsData Link Layer Numericals
Data Link Layer Numericals
 
Chapter23
Chapter23Chapter23
Chapter23
 
Data link layer
Data link layer Data link layer
Data link layer
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Ch21
Ch21Ch21
Ch21
 
Transportlayer tanenbaum
Transportlayer tanenbaumTransportlayer tanenbaum
Transportlayer tanenbaum
 
DATA RATE LIMITS
DATA RATE LIMITSDATA RATE LIMITS
DATA RATE LIMITS
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Unit 4 - Network Layer
Unit 4 - Network LayerUnit 4 - Network Layer
Unit 4 - Network Layer
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Stop-and-Wait ARQ Protocol
Stop-and-Wait ARQ ProtocolStop-and-Wait ARQ Protocol
Stop-and-Wait ARQ Protocol
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Data Link Control
Data Link ControlData Link Control
Data Link Control
 
Token bus
Token busToken bus
Token bus
 
Chapter 23
Chapter 23Chapter 23
Chapter 23
 
Multiple Access Protocal
Multiple Access ProtocalMultiple Access Protocal
Multiple Access Protocal
 
Binary tree
Binary tree Binary tree
Binary tree
 
SYBSC IT COMPUTER NETWORKS UNIT III Wired LANS: Ethernet
SYBSC IT COMPUTER NETWORKS UNIT III Wired LANS: EthernetSYBSC IT COMPUTER NETWORKS UNIT III Wired LANS: Ethernet
SYBSC IT COMPUTER NETWORKS UNIT III Wired LANS: Ethernet
 
Framing Protocols
Framing ProtocolsFraming Protocols
Framing Protocols
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 

Semelhante a Concurrency control

Svetlin Nakov - Database Transactions
Svetlin Nakov - Database TransactionsSvetlin Nakov - Database Transactions
Svetlin Nakov - Database Transactions
Svetlin Nakov
 
Databases: Concurrency Control
Databases: Concurrency ControlDatabases: Concurrency Control
Databases: Concurrency Control
Damian T. Gordon
 
CONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdfCONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdf
BijayNag1
 
Introduction to transaction processing
Introduction to transaction processingIntroduction to transaction processing
Introduction to transaction processing
Jafar Nesargi
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
Jafar Nesargi
 
Chapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
Jafar Nesargi
 

Semelhante a Concurrency control (20)

database1.pptx
database1.pptxdatabase1.pptx
database1.pptx
 
Dbms module iii
Dbms module iiiDbms module iii
Dbms module iii
 
Svetlin Nakov - Database Transactions
Svetlin Nakov - Database TransactionsSvetlin Nakov - Database Transactions
Svetlin Nakov - Database Transactions
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
 
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
 
Dbms
DbmsDbms
Dbms
 
24904 lecture11
24904 lecture1124904 lecture11
24904 lecture11
 
unit 4.pptx
unit 4.pptxunit 4.pptx
unit 4.pptx
 
protocols of concurrency control
protocols of concurrency controlprotocols of concurrency control
protocols of concurrency control
 
Databases: Concurrency Control
Databases: Concurrency ControlDatabases: Concurrency Control
Databases: Concurrency Control
 
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
 
The dude's guide to database consistency
The dude's guide to database consistencyThe dude's guide to database consistency
The dude's guide to database consistency
 
Question answer
Question answerQuestion answer
Question answer
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
CONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdfCONCURRENCY CONTOL notes.pdf
CONCURRENCY CONTOL notes.pdf
 
Unit 5
Unit 5Unit 5
Unit 5
 
dbms sanat ppt.pdf
dbms sanat ppt.pdfdbms sanat ppt.pdf
dbms sanat ppt.pdf
 
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
 

Mais de PratibhaRashmiSingh (6)

Transaction
TransactionTransaction
Transaction
 
Schedule in DBMS
Schedule in DBMSSchedule in DBMS
Schedule in DBMS
 
Types of normalization
Types of normalizationTypes of normalization
Types of normalization
 
Normalization
NormalizationNormalization
Normalization
 
Data manipulation language
Data manipulation languageData manipulation language
Data manipulation language
 
Sql
SqlSql
Sql
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 

Concurrency control

  • 2.  When many people try to make modifications to a database at any point of time, there should be a system of controls in place to ensure that changes made by one do not adversely affect the other, this is calledadversely affect the other, this is called concurrency control.  Concurrency control deals with interleaved execution of more than one transaction.
  • 3.  When multiple transactions execute concurrently in an uncontrolled or unrestricted manner, then it might lead to several problems. Such problems are called as concurrency problems. concurrency problems In transaction Dirty Read Problem Unrepeatable Read Problem Phantom Read Problem Lost Update Problem
  • 4. The concurrency problems are:-  Dirty Read Problem  Unrepeatable Read Problem  Phantom Read Problem  Lost Update Problem
  • 5.  Dirty Read: Reading the data written by an uncommitted transaction is called as dirty read. This read is called as dirty read because- There is always a chance that the There is always a chance that the uncommitted transaction might roll back later.  Thus, uncommitted transaction might make other transactions read a value that does not even exist.  This leads to inconsistency of the database.
  • 6.  Dirty read does not lead to inconsistency always.  It becomes problematic only when the uncommitted transaction fails and roll backs later due to some reason.later due to some reason.
  • 7.
  • 8.  Here, T1 reads the value of A. T1 updates the value of A in the buffer. T2 reads the value of A from the buffer. T2 writes the updated the value of A. T2 commits.T2 commits. T1 fails in later stages and rolls back.  In this example, 1. T2 reads the dirty value of A written by the uncommitted transaction T1. 2. T1 fails in later stages and roll backs. 3. Thus, the value that T2 read now stands to be incorrect. 4. Therefore, database becomes inconsistent.
  • 9.  This problem occurs when a transaction gets to read unrepeated i.e. different values of the same variable in its different read operations even when it has not updated its value.value.
  • 10.  Here, T1 reads the value of X (= 10 say). T2 reads the value of X (= 10). T1 updates the value of X (from 10 to 15 say) in the buffer. T2 again reads the value of X (but = 15).  In this example, 1. T2 gets to read a different value of X in its second reading. 2. T2 wonders how the value of X got changed because according to it, it is running in isolation.
  • 11.  This problem occurs when a transaction reads some variable from the buffer and when it reads the same variable later, it finds that the variable does not exist.
  • 12.  Here, T1 reads X. T2 reads X. T1 deletes X. T2 tries reading X but does not find it.T2 tries reading X but does not find it.  In this example, 1. T2 finds that there does not exist any variable X when it tries reading X again. 2. T2 wonders who deleted the variable X because according to it, it is running in isolation.
  • 13.  This problem occurs when multiple transactions execute concurrently and updates from one or more transactions get lost.
  • 14.  Here, T1 reads the value of A (= 10 say). T2 updates the value to A (= 15 say) in the buffer. T2 does blind write A = 25 (write without read) in the buffer. T2 commits. When T1 commits, it writes A = 25 in the database.  In this example, In this example, 1. T1 writes the over written value of X in the database. 2. Thus, update from T1 gets lost. NOTE-  This problem occurs whenever there is a write-write conflict.  In write-write conflict, there are two writes one by each transaction on the same data item without any read in the middle.
  • 15.  To ensure consistency of the database, it is very important to prevent the occurrence of above problems.  Concurrency Control Protocols help to prevent the occurrence of above problemsprevent the occurrence of above problems and maintain the consistency of the database.
  • 16.  If the transaction is rolled back, all the database changes made inside the transaction are ___________ A. made permanent B. made temporary C. copied to the logC. copied to the log D. undone  In ________ one transaction overwrites the changes of another transaction. A. uncommitted read problem B. lost update problem C. update lost problem D. dirty read problem
  • 17.  In a dirty read problem _________ A. one transaction reads an uncommitted value of another transaction B. one transaction reads the committed value for another transaction C. one transaction reads another transaction D. one transaction commits another transaction. C. one transaction reads another transaction D. one transaction commits another transaction.  Isolation of the transactions is ensured by A. Transaction management B. Application programmer C. Concurrency control D. Recovery management
  • 18.  Define the term Concurrency Control.  What is dirty read and phantom read?  What is inconsistent read problem?  What is the mean of write- write problem? Reference: https://www.gatevidyalay.com/, http://beginnersbook.com