SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
A Research
On
“Lock base concurrency control”
For Partial Fulfillment of the Requirements for the Degree of
Master of Computer Information System Awarded by
Pokhara University
Date: 24 July 2019
Table of Contents
1. Introduction.............................................................................................................................. 1
2. Locking Based Algorithms ...................................................................................................... 2
3. Lock-Based Protocols Example............................................................................................... 4
4. Lock Based protocols .............................................................................................................. 5
5. 2PL for DDBMS...................................................................................................................... 6
5.1 Centralized 2PL..................................................................................................................... 6
5.2 Primary copy 2PL ................................................................................................................. 6
5.3 Distributed 2PL..................................................................................................................... 7
6. Communication structure of the distributed 2PL..................................................................... 8
7. Conclusion............................................................................................................................... 9
8. References.............................................................................................................................. 10
Abstract
The lock base concurrency control is a well-accepted method to handle database transaction at
execution time. When the multiple users try to access data at exactly the same time lock-based
concurrency control manipulation and lock the database execution and provide effective data to
the user. Without the concurrency control, there might be a problem with performance in a
database transaction. Multiple frameworks based database concurrency control is the most
important element for proper functioning
1
1. Introduction
A lock is a variable related with an information thing that depicts a status of information thing as
for conceivable activity that can be connected to it. They synchronize the entrance by
simultaneous exchanges to the database things. It is required in this convention that every one of
the information things must be gotten to in a fundamentally unrelated way. Give me a chance to
acquaint you with two regular locks which are utilized and some wording followed in this
convention. A lock is a data variable which is associated with a data item. This lock signifies that
operations that can be performed on the data item. Locks help synchronize access to the database
items by concurrent transactions. All lock requests are made to the concurrency-control manager.
Transactions proceed only once the lock request is granted.
2
2. Locking Based Algorithms
Locking-based concurrency algorithms ensure that data items shared by conflicting operations
are accessed in a mutually exclusive way. This is accomplished by associating a “lock” with each
such data item.
Terminology Use in this protocol
Shared Lock (S): also known as Read-only lock. As the name suggests it can be shared between
transactions because while holding this lock the transaction does not have the permission to
update data on the data item. S-lock is requested using lock-S instruction.
Exclusive Lock (X): Data item can be both read as well as written. This is Exclusive and cannot
be held simultaneously on the same data item. X-lock is requested using lock-X instruction.
 Two types of locks (lock modes)
o Read lock (rl) – also called shared lock
o Write lock (wl) – also called exclusive lock
 Compatibility matrix of locks
rl
i
(x) wl
i
(x) rl
j
(x) Compatible not compatible wl
j
(x) Not compatible not compatible
 General locking algorithm
1. Before using a data item x, transaction requests lock for x from the lock manager
3
2. If x is already locked and the existing lock is incompatible with the requested
lock, the Transaction is delayed
3. Otherwise, the lock is granted.
4
3. Lock-Based Protocols Example
Transaction performing locking:
T2: lock-S (A);
Read (A);
Unlock (A);
Lock-S (B);
Read (B);
Unlock (B);
Display (A+B)
 Locking as above is not sufficient to guarantee serializability — if A and B get updated
in-between the read of A and B, the displayed sum would be wrong.
 A locking protocol is a set of rules followed by all transactions while requesting and
releasing locks. Locking protocols restrict the set of possible schedules
5
4. Lock Based protocols
4.1 Two-phase locking protocol (2PL)
Each transaction is executed in two phases
 Growing phase:
-Transaction may obtain locks
-Transaction may not release locks
 Shrinking phase: the transaction releases locks
- Transaction may release locks
- Transaction may not obtain locks
4.1.1 Properties of the 2PL protocol
Generates conflict-serializable schedules – But schedules may cause cascading aborts
If a transaction aborts after it releases a lock, it may cause other transactions that have accessed
the unlocked data item to abort as well.
 Strict 2PL locking protocol
 Holds the locks till the end of the transaction – Cascading aborts are avoided
6
5. 2PL for DDBMS
Various extensions of the 2PL to DDBMS
5.1 Centralized 2PL
A single site is responsible for the lock management, i.e., one lock manager for the whole
DDBMS – Lock requests are issued to the lock manager – Coordinating transaction manager
(TM at site where the transaction is initiated) can make all locking requests on behalf of local
transaction managers.
• Advantage:
Easy to implement
• Disadvantages:
Bottlenecks and lower reliability
Replica control protocol is additionally needed if data are replicated.
5.2 Primary copy 2PL
– Several lock managers are distributed to a number of sites
– Each lock manager is responsible for managing the locks for a set of data items
– For replicated data items, one copy is chosen as primary copy, others are slave copies
– Only the primary copy of a data item that is updated needs to be write-locked
– Once primary copy has been updated, the change is propagated to the slaves
• Advantages
– Lower communication costs and better performance than the centralized 2PL
• Disadvantages
– Deadlock handling is more complex
7
5.3 Distributed 2PL
– Lock managers are distributed to all sites
– Each lock manager responsible for locks for data at that site
– If data is not replicated, it is equivalent to primary copy 2PL
– If data is replicated, the Read-One-Write-All (ROWA) replica control protocol is
Implemented ∗ Read(x): Any copy of a replicated item x can be read by obtaining a read lock on
The copy ∗ Write(x): All copies of x must be write-locked before x can be updated
• Disadvantages
– Deadlock handling more complex
– Communication costs higher than primary copy 2PL
8
6. Communication structure of the distributed 2PL
The coordinating TM sends the lock request to the lock managers of all participating Sites.
– The LMs pass the operations to the data processors
– The end of the operation is signaled to the coordinating TM
Fig: Communication structure of the distributed 2PL
9
7. Conclusion
Concurrency orders the operations of transactions such that two properties are achieved: the
database is always in a consistent state and the maximum concurrencies of operations are
achieved. Concurrency Control is a problem that arises when multiple processes are involved in
any part of the system. In most commercial systems, the most popular mechanism for
concurrency control is two-phase locking.
10
8. References
 Principles of distributed Database System
M. Tamer Ozsu (Book)
 www.codex.cs.yale.edu

Contenu connexe

Tendances

management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing modelsishmecse13
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!Ashish K
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architectureYisal Khan
 
Advanced Operating System Lecture Notes
Advanced Operating System Lecture NotesAdvanced Operating System Lecture Notes
Advanced Operating System Lecture NotesAnirudhan Guru
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPTShushrutGupta
 
Deadlock management
Deadlock managementDeadlock management
Deadlock managementAhmed kasim
 
Load Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseLoad Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseMd. Shamsur Rahim
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating SystemsDr Sandeep Kumar Poonia
 
Optimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed SystemsOptimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed Systemsmridul mishra
 
Scheduling in distributed systems - Andrii Vozniuk
Scheduling in distributed systems - Andrii VozniukScheduling in distributed systems - Andrii Vozniuk
Scheduling in distributed systems - Andrii VozniukAndrii Vozniuk
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocksA. S. M. Shafi
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOLKABILESH RAMAR
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsSachin Chauhan
 

Tendances (20)

management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing models
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
 
concurrency-control
concurrency-controlconcurrency-control
concurrency-control
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architecture
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Advanced Operating System Lecture Notes
Advanced Operating System Lecture NotesAdvanced Operating System Lecture Notes
Advanced Operating System Lecture Notes
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPT
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
Load Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseLoad Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed Database
 
Distributed Systems Naming
Distributed Systems NamingDistributed Systems Naming
Distributed Systems Naming
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
 
Optimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed SystemsOptimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed Systems
 
Scheduling in distributed systems - Andrii Vozniuk
Scheduling in distributed systems - Andrii VozniukScheduling in distributed systems - Andrii Vozniuk
Scheduling in distributed systems - Andrii Vozniuk
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
 
Distributed Transaction
Distributed TransactionDistributed Transaction
Distributed Transaction
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL
 
Distributed Coordination-Based Systems
Distributed Coordination-Based SystemsDistributed Coordination-Based Systems
Distributed Coordination-Based Systems
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit Protocols
 

Similaire à Locking base concurrency control

Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.pptBikalAdhikari4
 
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
 
Linux kernel development_ch9-10_20120410
Linux kernel development_ch9-10_20120410Linux kernel development_ch9-10_20120410
Linux kernel development_ch9-10_20120410huangachou
 
Linux kernel development chapter 10
Linux kernel development chapter 10Linux kernel development chapter 10
Linux kernel development chapter 10huangachou
 
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
 
7 concurrency controltwo
7 concurrency controltwo7 concurrency controltwo
7 concurrency controltwoashish61_scs
 
7 concurrency controltwo
7 concurrency controltwo7 concurrency controltwo
7 concurrency controltwoashish61_scs
 
Concurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxConcurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxMArshad35
 
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...Zeeve
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! EdholeEdhole.com
 

Similaire à Locking base concurrency control (20)

Vani dbms
Vani dbmsVani dbms
Vani dbms
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.ppt
 
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
 
Linux kernel development_ch9-10_20120410
Linux kernel development_ch9-10_20120410Linux kernel development_ch9-10_20120410
Linux kernel development_ch9-10_20120410
 
Linux kernel development chapter 10
Linux kernel development chapter 10Linux kernel development chapter 10
Linux kernel development chapter 10
 
Dbms voc 5 unit
Dbms voc 5 unitDbms voc 5 unit
Dbms voc 5 unit
 
Concurrent control
Concurrent controlConcurrent control
Concurrent control
 
Dbms
DbmsDbms
Dbms
 
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...
 
7 concurrency controltwo
7 concurrency controltwo7 concurrency controltwo
7 concurrency controltwo
 
7 concurrency controltwo
7 concurrency controltwo7 concurrency controltwo
7 concurrency controltwo
 
Concurrency Control
Concurrency ControlConcurrency Control
Concurrency Control
 
Concurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxConcurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptx
 
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 

Plus de Prakash Poudel

Web applications vulnerabilities and threats
Web applications vulnerabilities and threatsWeb applications vulnerabilities and threats
Web applications vulnerabilities and threatsPrakash Poudel
 
Earliest Due Date Algorithm for Task scheduling for cloud computing
Earliest Due Date  Algorithm for Task scheduling for cloud computingEarliest Due Date  Algorithm for Task scheduling for cloud computing
Earliest Due Date Algorithm for Task scheduling for cloud computingPrakash Poudel
 
Recent and-future-trends spm
Recent and-future-trends spmRecent and-future-trends spm
Recent and-future-trends spmPrakash Poudel
 
Cocomo ( cot constrictive model) and capability maturity model
Cocomo ( cot constrictive model) and capability maturity modelCocomo ( cot constrictive model) and capability maturity model
Cocomo ( cot constrictive model) and capability maturity modelPrakash Poudel
 
Maximum power transfer theorem
Maximum power transfer theoremMaximum power transfer theorem
Maximum power transfer theoremPrakash Poudel
 
Telephone call-simulation
Telephone call-simulationTelephone call-simulation
Telephone call-simulationPrakash Poudel
 
General Online Health Information System Proposed Application
General Online Health Information System Proposed ApplicationGeneral Online Health Information System Proposed Application
General Online Health Information System Proposed ApplicationPrakash Poudel
 
Nepal Doorsanchar Company Limited Internship Experience
Nepal Doorsanchar Company Limited Internship Experience Nepal Doorsanchar Company Limited Internship Experience
Nepal Doorsanchar Company Limited Internship Experience Prakash Poudel
 
Multimedia Technology in computer
Multimedia Technology in computerMultimedia Technology in computer
Multimedia Technology in computerPrakash Poudel
 
File permission in linux
File permission in linuxFile permission in linux
File permission in linuxPrakash Poudel
 
organization Management
organization Managementorganization Management
organization ManagementPrakash Poudel
 
Organization Management Concept
Organization Management Concept Organization Management Concept
Organization Management Concept Prakash Poudel
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept Prakash Poudel
 

Plus de Prakash Poudel (20)

Web applications vulnerabilities and threats
Web applications vulnerabilities and threatsWeb applications vulnerabilities and threats
Web applications vulnerabilities and threats
 
Earliest Due Date Algorithm for Task scheduling for cloud computing
Earliest Due Date  Algorithm for Task scheduling for cloud computingEarliest Due Date  Algorithm for Task scheduling for cloud computing
Earliest Due Date Algorithm for Task scheduling for cloud computing
 
Recent and-future-trends spm
Recent and-future-trends spmRecent and-future-trends spm
Recent and-future-trends spm
 
Cocomo ( cot constrictive model) and capability maturity model
Cocomo ( cot constrictive model) and capability maturity modelCocomo ( cot constrictive model) and capability maturity model
Cocomo ( cot constrictive model) and capability maturity model
 
Microprocessor
Microprocessor Microprocessor
Microprocessor
 
Maximum power transfer theorem
Maximum power transfer theoremMaximum power transfer theorem
Maximum power transfer theorem
 
Linux technology
Linux technologyLinux technology
Linux technology
 
Java PU solution
Java PU solution Java PU solution
Java PU solution
 
System administration
System administrationSystem administration
System administration
 
Telephone call-simulation
Telephone call-simulationTelephone call-simulation
Telephone call-simulation
 
General Online Health Information System Proposed Application
General Online Health Information System Proposed ApplicationGeneral Online Health Information System Proposed Application
General Online Health Information System Proposed Application
 
Nepal Doorsanchar Company Limited Internship Experience
Nepal Doorsanchar Company Limited Internship Experience Nepal Doorsanchar Company Limited Internship Experience
Nepal Doorsanchar Company Limited Internship Experience
 
SQL & PLSQL
SQL & PLSQLSQL & PLSQL
SQL & PLSQL
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Multimedia Technology in computer
Multimedia Technology in computerMultimedia Technology in computer
Multimedia Technology in computer
 
File permission in linux
File permission in linuxFile permission in linux
File permission in linux
 
organization Management
organization Managementorganization Management
organization Management
 
Organization Management Concept
Organization Management Concept Organization Management Concept
Organization Management Concept
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept
 
Letest
LetestLetest
Letest
 

Dernier

Engineering Mechanics Chapter 5 Equilibrium of a Rigid Body
Engineering Mechanics  Chapter 5  Equilibrium of a Rigid BodyEngineering Mechanics  Chapter 5  Equilibrium of a Rigid Body
Engineering Mechanics Chapter 5 Equilibrium of a Rigid BodyAhmadHajasad2
 
News web APP using NEWS API for web platform to enhancing user experience
News web APP using NEWS API for web platform to enhancing user experienceNews web APP using NEWS API for web platform to enhancing user experience
News web APP using NEWS API for web platform to enhancing user experienceAkashJha84
 
The relationship between iot and communication technology
The relationship between iot and communication technologyThe relationship between iot and communication technology
The relationship between iot and communication technologyabdulkadirmukarram03
 
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdfSummer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdfNaveenVerma126
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Technology Features of Apollo HDD Machine, Its Technical Specification with C...
Technology Features of Apollo HDD Machine, Its Technical Specification with C...Technology Features of Apollo HDD Machine, Its Technical Specification with C...
Technology Features of Apollo HDD Machine, Its Technical Specification with C...Apollo Techno Industries Pvt Ltd
 
SUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docx
SUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docxSUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docx
SUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docxNaveenVerma126
 
Technical Management of cement industry.pdf
Technical Management of cement industry.pdfTechnical Management of cement industry.pdf
Technical Management of cement industry.pdfMadan Karki
 
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
ChatGPT-and-Generative-AI-Landscape Working of generative ai searchChatGPT-and-Generative-AI-Landscape Working of generative ai search
ChatGPT-and-Generative-AI-Landscape Working of generative ai searchrohitcse52
 
Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...
Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...
Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...amrabdallah9
 
cme397 surface engineering unit 5 part A questions and answers
cme397 surface engineering unit 5 part A questions and answerscme397 surface engineering unit 5 part A questions and answers
cme397 surface engineering unit 5 part A questions and answerskarthi keyan
 
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Transforming Process Safety Management: Challenges, Benefits, and Transition ...Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Transforming Process Safety Management: Challenges, Benefits, and Transition ...soginsider
 
دليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratory
دليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratoryدليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratory
دليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide LaboratoryBahzad5
 
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptxUNIT4_ESD_wfffffggggggggggggith_ARM.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptxrealme6igamerr
 
Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...
Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...
Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...Amil baba
 
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptxIT3401-WEB ESSENTIALS PRESENTATIONS.pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptxSAJITHABANUS
 

Dernier (20)

Présentation IIRB 2024 Chloe Dufrane.pdf
Présentation IIRB 2024 Chloe Dufrane.pdfPrésentation IIRB 2024 Chloe Dufrane.pdf
Présentation IIRB 2024 Chloe Dufrane.pdf
 
Engineering Mechanics Chapter 5 Equilibrium of a Rigid Body
Engineering Mechanics  Chapter 5  Equilibrium of a Rigid BodyEngineering Mechanics  Chapter 5  Equilibrium of a Rigid Body
Engineering Mechanics Chapter 5 Equilibrium of a Rigid Body
 
News web APP using NEWS API for web platform to enhancing user experience
News web APP using NEWS API for web platform to enhancing user experienceNews web APP using NEWS API for web platform to enhancing user experience
News web APP using NEWS API for web platform to enhancing user experience
 
計劃趕得上變化
計劃趕得上變化計劃趕得上變化
計劃趕得上變化
 
The relationship between iot and communication technology
The relationship between iot and communication technologyThe relationship between iot and communication technology
The relationship between iot and communication technology
 
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdfSummer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
 
Présentation IIRB 2024 Marine Cordonnier.pdf
Présentation IIRB 2024 Marine Cordonnier.pdfPrésentation IIRB 2024 Marine Cordonnier.pdf
Présentation IIRB 2024 Marine Cordonnier.pdf
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Technology Features of Apollo HDD Machine, Its Technical Specification with C...
Technology Features of Apollo HDD Machine, Its Technical Specification with C...Technology Features of Apollo HDD Machine, Its Technical Specification with C...
Technology Features of Apollo HDD Machine, Its Technical Specification with C...
 
SUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docx
SUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docxSUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docx
SUMMER TRAINING REPORT ON BUILDING CONSTRUCTION.docx
 
Technical Management of cement industry.pdf
Technical Management of cement industry.pdfTechnical Management of cement industry.pdf
Technical Management of cement industry.pdf
 
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
ChatGPT-and-Generative-AI-Landscape Working of generative ai searchChatGPT-and-Generative-AI-Landscape Working of generative ai search
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
 
Lecture 2 .pdf
Lecture 2                           .pdfLecture 2                           .pdf
Lecture 2 .pdf
 
Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...
Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...
Strategies of Urban Morphologyfor Improving Outdoor Thermal Comfort and Susta...
 
cme397 surface engineering unit 5 part A questions and answers
cme397 surface engineering unit 5 part A questions and answerscme397 surface engineering unit 5 part A questions and answers
cme397 surface engineering unit 5 part A questions and answers
 
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Transforming Process Safety Management: Challenges, Benefits, and Transition ...Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
 
دليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratory
دليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratoryدليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratory
دليل تجارب الاسفلت المختبرية - Asphalt Experiments Guide Laboratory
 
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptxUNIT4_ESD_wfffffggggggggggggith_ARM.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
 
Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...
Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...
Popular-NO1 Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialis...
 
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptxIT3401-WEB ESSENTIALS PRESENTATIONS.pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
 

Locking base concurrency control

  • 1. A Research On “Lock base concurrency control” For Partial Fulfillment of the Requirements for the Degree of Master of Computer Information System Awarded by Pokhara University Date: 24 July 2019
  • 2. Table of Contents 1. Introduction.............................................................................................................................. 1 2. Locking Based Algorithms ...................................................................................................... 2 3. Lock-Based Protocols Example............................................................................................... 4 4. Lock Based protocols .............................................................................................................. 5 5. 2PL for DDBMS...................................................................................................................... 6 5.1 Centralized 2PL..................................................................................................................... 6 5.2 Primary copy 2PL ................................................................................................................. 6 5.3 Distributed 2PL..................................................................................................................... 7 6. Communication structure of the distributed 2PL..................................................................... 8 7. Conclusion............................................................................................................................... 9 8. References.............................................................................................................................. 10
  • 3. Abstract The lock base concurrency control is a well-accepted method to handle database transaction at execution time. When the multiple users try to access data at exactly the same time lock-based concurrency control manipulation and lock the database execution and provide effective data to the user. Without the concurrency control, there might be a problem with performance in a database transaction. Multiple frameworks based database concurrency control is the most important element for proper functioning
  • 4. 1 1. Introduction A lock is a variable related with an information thing that depicts a status of information thing as for conceivable activity that can be connected to it. They synchronize the entrance by simultaneous exchanges to the database things. It is required in this convention that every one of the information things must be gotten to in a fundamentally unrelated way. Give me a chance to acquaint you with two regular locks which are utilized and some wording followed in this convention. A lock is a data variable which is associated with a data item. This lock signifies that operations that can be performed on the data item. Locks help synchronize access to the database items by concurrent transactions. All lock requests are made to the concurrency-control manager. Transactions proceed only once the lock request is granted.
  • 5. 2 2. Locking Based Algorithms Locking-based concurrency algorithms ensure that data items shared by conflicting operations are accessed in a mutually exclusive way. This is accomplished by associating a “lock” with each such data item. Terminology Use in this protocol Shared Lock (S): also known as Read-only lock. As the name suggests it can be shared between transactions because while holding this lock the transaction does not have the permission to update data on the data item. S-lock is requested using lock-S instruction. Exclusive Lock (X): Data item can be both read as well as written. This is Exclusive and cannot be held simultaneously on the same data item. X-lock is requested using lock-X instruction.  Two types of locks (lock modes) o Read lock (rl) – also called shared lock o Write lock (wl) – also called exclusive lock  Compatibility matrix of locks rl i (x) wl i (x) rl j (x) Compatible not compatible wl j (x) Not compatible not compatible  General locking algorithm 1. Before using a data item x, transaction requests lock for x from the lock manager
  • 6. 3 2. If x is already locked and the existing lock is incompatible with the requested lock, the Transaction is delayed 3. Otherwise, the lock is granted.
  • 7. 4 3. Lock-Based Protocols Example Transaction performing locking: T2: lock-S (A); Read (A); Unlock (A); Lock-S (B); Read (B); Unlock (B); Display (A+B)  Locking as above is not sufficient to guarantee serializability — if A and B get updated in-between the read of A and B, the displayed sum would be wrong.  A locking protocol is a set of rules followed by all transactions while requesting and releasing locks. Locking protocols restrict the set of possible schedules
  • 8. 5 4. Lock Based protocols 4.1 Two-phase locking protocol (2PL) Each transaction is executed in two phases  Growing phase: -Transaction may obtain locks -Transaction may not release locks  Shrinking phase: the transaction releases locks - Transaction may release locks - Transaction may not obtain locks 4.1.1 Properties of the 2PL protocol Generates conflict-serializable schedules – But schedules may cause cascading aborts If a transaction aborts after it releases a lock, it may cause other transactions that have accessed the unlocked data item to abort as well.  Strict 2PL locking protocol  Holds the locks till the end of the transaction – Cascading aborts are avoided
  • 9. 6 5. 2PL for DDBMS Various extensions of the 2PL to DDBMS 5.1 Centralized 2PL A single site is responsible for the lock management, i.e., one lock manager for the whole DDBMS – Lock requests are issued to the lock manager – Coordinating transaction manager (TM at site where the transaction is initiated) can make all locking requests on behalf of local transaction managers. • Advantage: Easy to implement • Disadvantages: Bottlenecks and lower reliability Replica control protocol is additionally needed if data are replicated. 5.2 Primary copy 2PL – Several lock managers are distributed to a number of sites – Each lock manager is responsible for managing the locks for a set of data items – For replicated data items, one copy is chosen as primary copy, others are slave copies – Only the primary copy of a data item that is updated needs to be write-locked – Once primary copy has been updated, the change is propagated to the slaves • Advantages – Lower communication costs and better performance than the centralized 2PL • Disadvantages – Deadlock handling is more complex
  • 10. 7 5.3 Distributed 2PL – Lock managers are distributed to all sites – Each lock manager responsible for locks for data at that site – If data is not replicated, it is equivalent to primary copy 2PL – If data is replicated, the Read-One-Write-All (ROWA) replica control protocol is Implemented ∗ Read(x): Any copy of a replicated item x can be read by obtaining a read lock on The copy ∗ Write(x): All copies of x must be write-locked before x can be updated • Disadvantages – Deadlock handling more complex – Communication costs higher than primary copy 2PL
  • 11. 8 6. Communication structure of the distributed 2PL The coordinating TM sends the lock request to the lock managers of all participating Sites. – The LMs pass the operations to the data processors – The end of the operation is signaled to the coordinating TM Fig: Communication structure of the distributed 2PL
  • 12. 9 7. Conclusion Concurrency orders the operations of transactions such that two properties are achieved: the database is always in a consistent state and the maximum concurrencies of operations are achieved. Concurrency Control is a problem that arises when multiple processes are involved in any part of the system. In most commercial systems, the most popular mechanism for concurrency control is two-phase locking.
  • 13. 10 8. References  Principles of distributed Database System M. Tamer Ozsu (Book)  www.codex.cs.yale.edu