SlideShare a Scribd company logo
1 of 16
Download to read offline
Concurrency control
By chief Jacob Zvirikuzhe
Def
 Concurrency control is a database management systems
(DBMS) concept that is used to address conflicts with the
simultaneous accessing or altering of data that can occur
with a multi-user system.
con’
 Concurrency control, when applied to a DBMS, is meant to
coordinate simultaneous transactions while preserving data
integrity. [1] The Concurrency is about to control the multiuser access of Database
example
con
To illustrate the concept of concurrency control, consider two
travellers who go to electronic kiosks at the same time to
purchase a train ticket to the same destination on the same
train. There's only one seat left in the coach, but without
concurrency control, it's possible that both travellers will end up
purchasing a ticket for that one seat. However, with
concurrency control, the database wouldn't allow this to
happen. Both travellers would still be able to access the train
seating database, but concurrency control would preserve data
accuracy and allow only one traveller to purchase the seat.
con
 This example also illustrates the importance of addressing
this issue in a multi-user database. Obviously, one could
quickly run into problems with the inaccurate data that can
result from several transactions occurring simultaneously and
writing over each other. The following section provides
strategies for implementing concurrency control.
Concurrency Control Locking
Strategies
Pessimistic Locking:
 This concurrency control strategy involves keeping an entity
in a database locked the entire time it exists in the database's
memory. [2] This limits or prevents users from altering the
data entity that is locked. There are two types of locks that
fall under the category of pessimistic locking: write lock and
read lock. [2]
 With write lock, everyone but the holder of the lock is
prevented from reading, updating, or deleting the entity. With
read lock, other users can read the entity, but no one except
for the lock holder can update or delete it. [2]
Optimistic Locking
 : This strategy can be used when instances of simultaneous
transactions, or collisions, are expected to be infrequent. [2] In
contrast with pessimistic locking, optimistic locking doesn't try to
prevent the collisions from occurring. Instead, it aims to detect
these collisions and resolve them on the chance occasions
when they occur. [2]
 Pessimistic locking provides a guarantee that database changes
are made safely. However, it becomes less viable as the number
of simultaneous users or the number of entities involved in a
transaction increase because the potential for having to wait for
a lock to release will increase. [2]
 Optimistic locking can alleviate the problem of waiting for locks
to release, but then users have the potential to experience
collisions when attempting to update the database.
Lock Problems:
Deadlock:
 When dealing with locks two problems can arise, the first of which being
deadlock. Deadlock refers to a particular situation where two or more
processes are each waiting for another to release a resource, or more than
two processes are waiting for resources in a circular chain. Deadlock is a
common problem in multiprocessing where many processes share a specific
type of mutually exclusive resource. Some computers, usually those
intended for the time-sharing and/or real-time markets, are often equipped
with a hardware lock, or hard lock, which guarantees exclusive access to
processes, forcing serialization. Deadlocks are particularly disconcerting
because there is no general solution to avoid them.
 A fitting analogy of the deadlock problem could be a situation like when you
go to unlock your car door and your passenger pulls the handle at the exact
same time, leaving the door still locked. If you have ever been in a situation
where the passenger is impatient and keeps trying to open the door, it can
be very frustrating. Basically you can get stuck in an endless cycle, and
since both actions cannot be satisfied, deadlock occurs
Livelock:
 Livelock is a special case of resource starvation. A livelock is
similar to a deadlock, except that the states of the processes
involved constantly change with regard to one another wile
never progressing. The general definition only states that a
specific process is not progressing. For example, the system
keeps selecting the same transaction for rollback causing the
transaction to never finish executing. Another livelock situation
can come about when the system is deciding which transaction
gets a lock and which waits in a conflict situation.
 An illustration of livelock occurs when numerous people arrive at
a four way stop, and are not quite sure who should proceed
next. If no one makes a solid decision to go, and all the cars just
keep creeping into the intersection afraid that someone else will
possibly hit them, then a kind of livelock can happen
Basic Timestamping:
 Basic timestamping is a concurrency control mechanism that
eliminates deadlock. This method doesn’t use locks to control
concurrency, so it is impossible for deadlock to occur.
According to this method a unique timestamp is assigned to
each transaction, usually showing when it was started. This
effectively allows an age to be assigned to transactions and
an order to be assigned. Data items have both a readtimestamp and a write-timestamp. These timestamps are
updated each time the data item is read or updated
respectively.
cont
 Problems arise in this system when a transaction tries to read a
data item which has been written by a younger transaction. This
is called a late read. This means that the data item has changed
since the initial transaction start time and the solution is to roll
back the timestamp and acquire a new one. Another problem
occurs when a transaction tries to write a data item which has
been read by a younger transaction. This is called a late write.
This means that the data item has been read by another
transaction since the start time of the transaction that is altering
it. The solution for this problem is the same as for the late read
problem. The timestamp must be rolled back and a new one
acquired.[3]
cont
 Adhering to the rules of the basic timestamping process
allows the transactions to be serialized and a chronological
schedule of transactions can then be created. Timestamping
may not be practical in the case of larger databases with high
levels of transactions. A large amount of storage space would
have to be dedicated to storing the timestamps in these
cases.[4]
Sources:
 [1] Coronel, Carlos, Peter Rob. Database Systems, sixth ed.
Thomson Course Technology, 2004.
 [2] Ambler, Scott. Introduction to Concurrency Control, 2006
<http://www.agiledata.org/essays/concurrencyControl.html>
 [2] Ambler, Scott. Introduction to Concurrency Control, 2006
<http://www.alkissdesigners.kbo.co.ke>
 [3] Ricardo, Catherine. Databases Illuminated, second ed. p386387 Jones & Bartlett Learning, 2012.
 [4] Kumar, V. Transaction Management Concurrency Control
Mechanisms, 2012
<http://sce.umkc.edu/~kumarv/cs470/transaction/Tmanagement.pdf

More Related Content

What's hot

Svetlin Nakov - Database Transactions
Svetlin Nakov - Database TransactionsSvetlin Nakov - Database Transactions
Svetlin Nakov - Database TransactionsSvetlin Nakov
 
Databases: Locking Methods
Databases: Locking MethodsDatabases: Locking Methods
Databases: Locking MethodsDamian T. Gordon
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency ControlAli Usman
 
Concurrency control ms neeti
Concurrency control ms neetiConcurrency control ms neeti
Concurrency control ms neetineeti arora
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMSkoolkampus
 
Concurrency control
Concurrency controlConcurrency control
Concurrency controlvarsha singh
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!Ashish K
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systemsmridul mishra
 
Locking unit 1 topic 3
Locking unit 1 topic 3Locking unit 1 topic 3
Locking unit 1 topic 3avniS
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPTShushrutGupta
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control TechniquesRaj vardhan
 
Multiversion Concurrency Control Techniques
Multiversion Concurrency Control TechniquesMultiversion Concurrency Control Techniques
Multiversion Concurrency Control TechniquesRaj vardhan
 
Concurrency of Issues of Distributed Advance Transaction
Concurrency of Issues of Distributed Advance TransactionConcurrency of Issues of Distributed Advance Transaction
Concurrency of Issues of Distributed Advance TransactionAbdelhafiz Khoudour
 
Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013Prosanta Ghosh
 

What's hot (19)

concurrency-control
concurrency-controlconcurrency-control
concurrency-control
 
Concurrency Control
Concurrency ControlConcurrency Control
Concurrency Control
 
Svetlin Nakov - Database Transactions
Svetlin Nakov - Database TransactionsSvetlin Nakov - Database Transactions
Svetlin Nakov - Database Transactions
 
Databases: Locking Methods
Databases: Locking MethodsDatabases: Locking Methods
Databases: Locking Methods
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency Control
 
Concurrency control ms neeti
Concurrency control ms neetiConcurrency control ms neeti
Concurrency control ms neeti
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
Concurrency control
Concurrency control Concurrency control
Concurrency control
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
 
Ch16
Ch16Ch16
Ch16
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systems
 
Locking unit 1 topic 3
Locking unit 1 topic 3Locking unit 1 topic 3
Locking unit 1 topic 3
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPT
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Multiversion Concurrency Control Techniques
Multiversion Concurrency Control TechniquesMultiversion Concurrency Control Techniques
Multiversion Concurrency Control Techniques
 
Concurrency of Issues of Distributed Advance Transaction
Concurrency of Issues of Distributed Advance TransactionConcurrency of Issues of Distributed Advance Transaction
Concurrency of Issues of Distributed Advance Transaction
 
Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013Dbms ii mca-ch10-concurrency-control-2013
Dbms ii mca-ch10-concurrency-control-2013
 

Viewers also liked

Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency ControlRavimuthurajan
 
Shared Database Concurrency
Shared Database ConcurrencyShared Database Concurrency
Shared Database ConcurrencyAivars Kalvans
 
multi-threading
multi-threadingmulti-threading
multi-threadingEzzat Gul
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency controlBinte fatima
 
System Data Modelling Tools
System Data Modelling ToolsSystem Data Modelling Tools
System Data Modelling ToolsLiam Dunphy
 
DDoS Attack on DNS using infected IoT Devices
DDoS Attack on DNS using infected IoT DevicesDDoS Attack on DNS using infected IoT Devices
DDoS Attack on DNS using infected IoT DevicesSeungjoo Kim
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
TransactionsmanagementSanjeev Gupta
 
Concurrency at the Database Layer
Concurrency at the Database Layer Concurrency at the Database Layer
Concurrency at the Database Layer mcwilson1
 
Transaction and concurrency control
Transaction and concurrency controlTransaction and concurrency control
Transaction and concurrency controlAnil Shrestha
 
Validation based protocol
Validation based protocolValidation based protocol
Validation based protocolBBDITM LUCKNOW
 
Validation Protocol
Validation ProtocolValidation Protocol
Validation ProtocolSagar Savale
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in JavaPrasad Sawant
 
E-commerce Business Models
E-commerce Business ModelsE-commerce Business Models
E-commerce Business ModelsLeah Famularo
 

Viewers also liked (20)

Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
 
Shared Database Concurrency
Shared Database ConcurrencyShared Database Concurrency
Shared Database Concurrency
 
multi-threading
multi-threadingmulti-threading
multi-threading
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
 
System Data Modelling Tools
System Data Modelling ToolsSystem Data Modelling Tools
System Data Modelling Tools
 
Tesina Sobri
Tesina SobriTesina Sobri
Tesina Sobri
 
DDoS Attack on DNS using infected IoT Devices
DDoS Attack on DNS using infected IoT DevicesDDoS Attack on DNS using infected IoT Devices
DDoS Attack on DNS using infected IoT Devices
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
Concurrency at the Database Layer
Concurrency at the Database Layer Concurrency at the Database Layer
Concurrency at the Database Layer
 
Transaction and concurrency control
Transaction and concurrency controlTransaction and concurrency control
Transaction and concurrency control
 
Paging-R.D.Sivakumar
Paging-R.D.SivakumarPaging-R.D.Sivakumar
Paging-R.D.Sivakumar
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Validation based protocol
Validation based protocolValidation based protocol
Validation based protocol
 
Validation Protocol
Validation ProtocolValidation Protocol
Validation Protocol
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
 
DbMs
DbMsDbMs
DbMs
 
OSI Model | Computer Science
OSI Model | Computer ScienceOSI Model | Computer Science
OSI Model | Computer Science
 
E-commerce Business Models
E-commerce Business ModelsE-commerce Business Models
E-commerce Business Models
 

Similar to Concurrency control

Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! EdholeEdhole.com
 
Type LocK based in Concurrency Control.pptx
Type LocK based in Concurrency Control.pptxType LocK based in Concurrency Control.pptx
Type LocK based in Concurrency Control.pptxemilinshyni2020
 
Concurrency control ms neeti
Concurrency control ms neetiConcurrency control ms neeti
Concurrency control ms neetineeti arora
 
Concurrency Control in RDBMS for Students.pptx
Concurrency Control in RDBMS for Students.pptxConcurrency Control in RDBMS for Students.pptx
Concurrency Control in RDBMS for Students.pptxemilinshyni2020
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesMeghaj Mallick
 
Deadlock and shadow paging
Deadlock and shadow pagingDeadlock and shadow paging
Deadlock and shadow pagingSiva Priya
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdfBijayNag1
 
Design & Development of an Advanced Database Management System Using Multiver...
Design & Development of an Advanced Database Management System Using Multiver...Design & Development of an Advanced Database Management System Using Multiver...
Design & Development of an Advanced Database Management System Using Multiver...IOSR Journals
 

Similar to Concurrency control (20)

Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 
Type LocK based in Concurrency Control.pptx
Type LocK based in Concurrency Control.pptxType LocK based in Concurrency Control.pptx
Type LocK based in Concurrency Control.pptx
 
Concurrency control ms neeti
Concurrency control ms neetiConcurrency control ms neeti
Concurrency control ms neeti
 
Rdbms
RdbmsRdbms
Rdbms
 
Concurrency Control in RDBMS for Students.pptx
Concurrency Control in RDBMS for Students.pptxConcurrency Control in RDBMS for Students.pptx
Concurrency Control in RDBMS for Students.pptx
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed Databases
 
Sql server concurrency
Sql server concurrencySql server concurrency
Sql server concurrency
 
Deadlock and shadow paging
Deadlock and shadow pagingDeadlock and shadow paging
Deadlock and shadow paging
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
 
Vani dbms
Vani dbmsVani dbms
Vani dbms
 
chp13.pdf
chp13.pdfchp13.pdf
chp13.pdf
 
F017213747
F017213747F017213747
F017213747
 
F017213747
F017213747F017213747
F017213747
 
Design & Development of an Advanced Database Management System Using Multiver...
Design & Development of an Advanced Database Management System Using Multiver...Design & Development of an Advanced Database Management System Using Multiver...
Design & Development of an Advanced Database Management System Using Multiver...
 
Process coordination
Process coordinationProcess coordination
Process coordination
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
Rdbms
RdbmsRdbms
Rdbms
 
Rdbms
RdbmsRdbms
Rdbms
 
Dbms voc 5 unit
Dbms voc 5 unitDbms voc 5 unit
Dbms voc 5 unit
 
What is a deadlock
What is a deadlockWhat is a deadlock
What is a deadlock
 

More from Jacob Zvirikuzhe

More from Jacob Zvirikuzhe (7)

Introduction to comp science
Introduction to comp scienceIntroduction to comp science
Introduction to comp science
 
Football footsteps half hour
Football footsteps half hourFootball footsteps half hour
Football footsteps half hour
 
Virtual machine security
Virtual machine securityVirtual machine security
Virtual machine security
 
Printing a workbook and worksheets
Printing a workbook and worksheetsPrinting a workbook and worksheets
Printing a workbook and worksheets
 
Printing a workbook and worksheets
Printing a workbook and worksheetsPrinting a workbook and worksheets
Printing a workbook and worksheets
 
Printers
PrintersPrinters
Printers
 
Printers
PrintersPrinters
Printers
 

Recently uploaded

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

Concurrency control

  • 1. Concurrency control By chief Jacob Zvirikuzhe
  • 2. Def  Concurrency control is a database management systems (DBMS) concept that is used to address conflicts with the simultaneous accessing or altering of data that can occur with a multi-user system.
  • 3. con’  Concurrency control, when applied to a DBMS, is meant to coordinate simultaneous transactions while preserving data integrity. [1] The Concurrency is about to control the multiuser access of Database
  • 5. con To illustrate the concept of concurrency control, consider two travellers who go to electronic kiosks at the same time to purchase a train ticket to the same destination on the same train. There's only one seat left in the coach, but without concurrency control, it's possible that both travellers will end up purchasing a ticket for that one seat. However, with concurrency control, the database wouldn't allow this to happen. Both travellers would still be able to access the train seating database, but concurrency control would preserve data accuracy and allow only one traveller to purchase the seat.
  • 6. con  This example also illustrates the importance of addressing this issue in a multi-user database. Obviously, one could quickly run into problems with the inaccurate data that can result from several transactions occurring simultaneously and writing over each other. The following section provides strategies for implementing concurrency control.
  • 8. Pessimistic Locking:  This concurrency control strategy involves keeping an entity in a database locked the entire time it exists in the database's memory. [2] This limits or prevents users from altering the data entity that is locked. There are two types of locks that fall under the category of pessimistic locking: write lock and read lock. [2]  With write lock, everyone but the holder of the lock is prevented from reading, updating, or deleting the entity. With read lock, other users can read the entity, but no one except for the lock holder can update or delete it. [2]
  • 9. Optimistic Locking  : This strategy can be used when instances of simultaneous transactions, or collisions, are expected to be infrequent. [2] In contrast with pessimistic locking, optimistic locking doesn't try to prevent the collisions from occurring. Instead, it aims to detect these collisions and resolve them on the chance occasions when they occur. [2]  Pessimistic locking provides a guarantee that database changes are made safely. However, it becomes less viable as the number of simultaneous users or the number of entities involved in a transaction increase because the potential for having to wait for a lock to release will increase. [2]  Optimistic locking can alleviate the problem of waiting for locks to release, but then users have the potential to experience collisions when attempting to update the database.
  • 11. Deadlock:  When dealing with locks two problems can arise, the first of which being deadlock. Deadlock refers to a particular situation where two or more processes are each waiting for another to release a resource, or more than two processes are waiting for resources in a circular chain. Deadlock is a common problem in multiprocessing where many processes share a specific type of mutually exclusive resource. Some computers, usually those intended for the time-sharing and/or real-time markets, are often equipped with a hardware lock, or hard lock, which guarantees exclusive access to processes, forcing serialization. Deadlocks are particularly disconcerting because there is no general solution to avoid them.  A fitting analogy of the deadlock problem could be a situation like when you go to unlock your car door and your passenger pulls the handle at the exact same time, leaving the door still locked. If you have ever been in a situation where the passenger is impatient and keeps trying to open the door, it can be very frustrating. Basically you can get stuck in an endless cycle, and since both actions cannot be satisfied, deadlock occurs
  • 12. Livelock:  Livelock is a special case of resource starvation. A livelock is similar to a deadlock, except that the states of the processes involved constantly change with regard to one another wile never progressing. The general definition only states that a specific process is not progressing. For example, the system keeps selecting the same transaction for rollback causing the transaction to never finish executing. Another livelock situation can come about when the system is deciding which transaction gets a lock and which waits in a conflict situation.  An illustration of livelock occurs when numerous people arrive at a four way stop, and are not quite sure who should proceed next. If no one makes a solid decision to go, and all the cars just keep creeping into the intersection afraid that someone else will possibly hit them, then a kind of livelock can happen
  • 13. Basic Timestamping:  Basic timestamping is a concurrency control mechanism that eliminates deadlock. This method doesn’t use locks to control concurrency, so it is impossible for deadlock to occur. According to this method a unique timestamp is assigned to each transaction, usually showing when it was started. This effectively allows an age to be assigned to transactions and an order to be assigned. Data items have both a readtimestamp and a write-timestamp. These timestamps are updated each time the data item is read or updated respectively.
  • 14. cont  Problems arise in this system when a transaction tries to read a data item which has been written by a younger transaction. This is called a late read. This means that the data item has changed since the initial transaction start time and the solution is to roll back the timestamp and acquire a new one. Another problem occurs when a transaction tries to write a data item which has been read by a younger transaction. This is called a late write. This means that the data item has been read by another transaction since the start time of the transaction that is altering it. The solution for this problem is the same as for the late read problem. The timestamp must be rolled back and a new one acquired.[3]
  • 15. cont  Adhering to the rules of the basic timestamping process allows the transactions to be serialized and a chronological schedule of transactions can then be created. Timestamping may not be practical in the case of larger databases with high levels of transactions. A large amount of storage space would have to be dedicated to storing the timestamps in these cases.[4]
  • 16. Sources:  [1] Coronel, Carlos, Peter Rob. Database Systems, sixth ed. Thomson Course Technology, 2004.  [2] Ambler, Scott. Introduction to Concurrency Control, 2006 <http://www.agiledata.org/essays/concurrencyControl.html>  [2] Ambler, Scott. Introduction to Concurrency Control, 2006 <http://www.alkissdesigners.kbo.co.ke>  [3] Ricardo, Catherine. Databases Illuminated, second ed. p386387 Jones & Bartlett Learning, 2012.  [4] Kumar, V. Transaction Management Concurrency Control Mechanisms, 2012 <http://sce.umkc.edu/~kumarv/cs470/transaction/Tmanagement.pdf