SlideShare a Scribd company logo
7
Most read
9
Most read
10
Most read
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

More Related Content

PPTX
Concurrency control!
PPT
2 PHASE COMMIT PROTOCOL
PPTX
Overview of Concurrency Control & Recovery in Distributed Databases
PPT
Deadlock management
PPTX
Concurrency Control
PDF
Database recovery techniques
PPTX
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
PPT
Classical problem of synchronization
Concurrency control!
2 PHASE COMMIT PROTOCOL
Overview of Concurrency Control & Recovery in Distributed Databases
Deadlock management
Concurrency Control
Database recovery techniques
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Classical problem of synchronization

What's hot (20)

PPT
Concurrency control
PPTX
Database ,11 Concurrency Control
PPTX
Asymmetric Cryptography.pptx
PPTX
Dead Lock in operating system
PDF
DDBMS_ Chap 7 Optimization of Distributed Queries
PPTX
What is NoSQL and CAP Theorem
PPTX
Concurrency control
PPT
16. Concurrency Control in DBMS
PDF
8. mutual exclusion in Distributed Operating Systems
PPTX
DBMS - RAID
PPTX
Deadlock dbms
PPTX
Database , 12 Reliability
PPTX
Distributed DBMS - Unit 6 - Query Processing
PPTX
Deadlock Prevention
PPTX
Concurrency Control in Distributed Systems.pptx
PPT
17. Recovery System in DBMS
PPTX
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
PPTX
database recovery techniques
PPTX
Virtual memory management in Operating System
PPTX
Transport Layer Security (TLS)
Concurrency control
Database ,11 Concurrency Control
Asymmetric Cryptography.pptx
Dead Lock in operating system
DDBMS_ Chap 7 Optimization of Distributed Queries
What is NoSQL and CAP Theorem
Concurrency control
16. Concurrency Control in DBMS
8. mutual exclusion in Distributed Operating Systems
DBMS - RAID
Deadlock dbms
Database , 12 Reliability
Distributed DBMS - Unit 6 - Query Processing
Deadlock Prevention
Concurrency Control in Distributed Systems.pptx
17. Recovery System in DBMS
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
database recovery techniques
Virtual memory management in Operating System
Transport Layer Security (TLS)
Ad

Similar to Locking base concurrency control (20)

PPTX
Vani dbms
PPTX
Concurrency Control in Distributed Database.
PDF
Linux kernel development chapter 10
PDF
Linux kernel development_ch9-10_20120410
DOCX
Dbms voc 5 unit
PPTX
Concurrent control
PPTX
PDF
Design & Development of an Advanced Database Management System Using Multiver...
PDF
F017213747
PDF
F017213747
PPTX
DBMS Unit-5.4. Concurrency Control.pptx it is a PPT on the topic of concurren...
PDF
Advanced Database Chapter 4.pdf shnsbxlajmndm woweosmkl m,xcnkl C NOOxcx xcbnxc
PDF
7 concurrency controltwo
PDF
7 concurrency controltwo
PDF
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
PDF
seminarembedded-150504150805-conversion-gate02.pdf
PPTX
Real Time Operating Systems
PPTX
CST 402 Distributed Computing Module 1 Notes
PDF
Mba ebooks ! Edhole
PDF
Vol 4 No 1 - August 2013
Vani dbms
Concurrency Control in Distributed Database.
Linux kernel development chapter 10
Linux kernel development_ch9-10_20120410
Dbms voc 5 unit
Concurrent control
Design & Development of an Advanced Database Management System Using Multiver...
F017213747
F017213747
DBMS Unit-5.4. Concurrency Control.pptx it is a PPT on the topic of concurren...
Advanced Database Chapter 4.pdf shnsbxlajmndm woweosmkl m,xcnkl C NOOxcx xcbnxc
7 concurrency controltwo
7 concurrency controltwo
Journey to Blockchain Scalability: A Close Look at Complete Scaling Solutions...
seminarembedded-150504150805-conversion-gate02.pdf
Real Time Operating Systems
CST 402 Distributed Computing Module 1 Notes
Mba ebooks ! Edhole
Vol 4 No 1 - August 2013
Ad

More from Prakash Poudel (20)

PPTX
Web applications vulnerabilities and threats
PPTX
Earliest Due Date Algorithm for Task scheduling for cloud computing
PPTX
Recent and-future-trends spm
PPTX
Cocomo ( cot constrictive model) and capability maturity model
PDF
Microprocessor
DOCX
Maximum power transfer theorem
DOCX
Linux technology
PDF
Java PU solution
PPTX
System administration
PPTX
Telephone call-simulation
PPTX
General Online Health Information System Proposed Application
PPTX
Nepal Doorsanchar Company Limited Internship Experience
DOCX
SQL & PLSQL
DOCX
Software engineering
DOCX
Multimedia Technology in computer
PPTX
File permission in linux
DOC
organization Management
DOC
Organization Management Concept
PPTX
Java Programming concept
PPTX
Web applications vulnerabilities and threats
Earliest Due Date Algorithm for Task scheduling for cloud computing
Recent and-future-trends spm
Cocomo ( cot constrictive model) and capability maturity model
Microprocessor
Maximum power transfer theorem
Linux technology
Java PU solution
System administration
Telephone call-simulation
General Online Health Information System Proposed Application
Nepal Doorsanchar Company Limited Internship Experience
SQL & PLSQL
Software engineering
Multimedia Technology in computer
File permission in linux
organization Management
Organization Management Concept
Java Programming concept

Recently uploaded (20)

PPTX
UNIT 4 Total Quality Management .pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPT
Project quality management in manufacturing
PDF
Well-logging-methods_new................
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Geodesy 1.pptx...............................................
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
573137875-Attendance-Management-System-original
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
additive manufacturing of ss316l using mig welding
PDF
composite construction of structures.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
OOP with Java - Java Introduction (Basics)
UNIT 4 Total Quality Management .pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Lecture Notes Electrical Wiring System Components
Project quality management in manufacturing
Well-logging-methods_new................
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mechanical Engineering MATERIALS Selection
bas. eng. economics group 4 presentation 1.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Foundation to blockchain - A guide to Blockchain Tech
Geodesy 1.pptx...............................................
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
573137875-Attendance-Management-System-original
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Model Code of Practice - Construction Work - 21102022 .pdf
additive manufacturing of ss316l using mig welding
composite construction of structures.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
OOP with Java - Java Introduction (Basics)

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