SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Concurrency Control
Techniques
Chapter 10
UNIT V
By C.Aruna Devi(DSCASC) 1
Data Base Management System
[DBMS]
Locking Techniques for concurrency control
The main technique used to control concurrent execution
of transaction are based on the concept of locking data
items.
A lock is a variable associated with a data item that
describes the status of the item with respect to possible
operations that can be applied to it.
Generally there is one lock for each data item in the
database.
By C.Aruna Devi(DSCASC) 2
Types of locks and system lock tables
Binary Locks.
Shared/Exclusive (or Read/write) Locks.
Conversion of Locks.
By C.Aruna Devi(DSCASC) 3
Binary Locks.
A binary lock can have two states or values: locked and unlocked
(or 1 and 0).
A distinct lock is associated with each database item X.
If the value of the lock on X is 1, item X cannot be accessed by a
database operation that request the item.
If the value of the lock on X is 0, the item can be accessed when
requested.
Refer pg 662 Navathe
By C.Aruna Devi(DSCASC) 4
Binary Lock
The following code performs the lock operation:
Lock_item(X):
B: if LOCK (X) = 0 (*item is unlocked*)
then LOCK (X) ← 1 (*lock the item*)
else begin
wait (until lock (X) = 0) and
the lock manager wakes up the transaction);
goto B
end;
By C.Aruna Devi(DSCASC) 5
Binary Unlock
The following code performs the unlock operation:
Unlock_item(X):
LOCK (X) ← 0 (*unlock the item*)
if any transactions are waiting then
wake up one of the waiting transactions;
By C.Aruna Devi(DSCASC) 6
Shared/Exclusive (or Read/write) Locks.
The following code performs the read lock operation:
(read_lock is also called shared_locked)
read_lock(X):
B: if LOCK (X) = “unlocked” then
begin LOCK (X) ← “read-locked”;
no_of_reads (X) ← 1;
end
else if LOCK (X) ← “read-locked” then
no_of_reads (X) ← no_of_reads (X) +1
else begin wait (until LOCK (X) = “unlocked” and
the lock manager wakes up the transaction);
goto B
end;
By C.Aruna Devi(DSCASC) 7
Shared/Exclusive (or Read/write) Locks.
The following code performs the write lock
operation:
(write_lock is also called exclusive_locked)
write_lock(X):
B: if LOCK (X) = “unlocked” then
LOCK (X) ← “write-locked”;
else begin
wait (until LOCK (X) = “unlocked” and
the lock manager wakes up the transaction);
goto B
end;
By C.Aruna Devi(DSCASC) 8
Shared/Exclusive (or Read/write) Locks.
The following code performs the unlock operation:
unlock(X):
if LOCK (X) = “write-locked” then
begin LOCK (X) ← “unlocked”;
wakes up one of the transactions, if any
end
else if LOCK (X) ← “read-locked” then
begin
no_of_reads (X) ← no_of_reads (X) -1
if no_of_reads (X) = 0 then
begin
LOCK (X) = “unlocked”;
wake up one of the transactions, if any
end
end;
By C.Aruna Devi(DSCASC) 9
Conversion of Lock
Two Phases: (a) Locking (Growing) (b) Unlocking (Shrinking):
Locking (Growing) Phase: A transaction applies locks (read or write) on
desired data items one at a time.
Unlocking (Shrinking) Phase: A transaction unlocks its locked data items
one at a time.
Requirement: For a transaction these two phases must be mutually
exclusively, that is, during locking phase unlocking phase must not start and
during unlocking phase locking phase must not begin.
Lock Conversion: That is, transaction that already holds a lock on item X is
allowed under certain conditions to convert the lock from one locked state
to another.
By C.Aruna Devi(DSCASC) 11
Conversion of Lock
For eg:
It is possible for a transaction T to issue a read_lock(X) and
then later on to upgrade the lock by issuing a write_lock(X)
operation.
If T is the only transaction holding a read lock on X at the time
it issues the write_lock(X) operation, the lock can be upgraded,
otherwise the transaction must wait.
It is also possible for a transaction T to issue a write_lock(X)
and then later on to downgrade the lock by issuing a
read_lock(X) operation.
By C.Aruna Devi(DSCASC) 12
Conversion of Lock
Two-Phase Locking Techniques: The algorithm
T1 T2 Result
read_lock (Y); read_lock (X); Initial values: X=20; Y=30
read_item (Y); read_item (X); Result of serial execution
unlock (Y); unlock (X); T1 followed by T2
write_lock (X); Write_lock (Y); X=50, Y=80.
read_item (X); read_item (Y); Result of serial execution
X:=X+Y; Y:=X+Y; T2 followed by T1
write_item (X); write_item (Y); X=70, Y=50
unlock (X); unlock (Y);
By C.Aruna Devi(DSCASC) 13
Conversion of Lock
Two-Phase Locking Techniques: The algorithm
T1 T2 Result
read_lock (Y); X=50; Y=50
read_item (Y); Nonserializable because it.
unlock (Y); violated two-phase policy.
read_lock (X);
read_item (X);
unlock (X);
write_lock (Y);
read_item (Y);
Y:=X+Y;
write_item (Y);
unlock (Y);
write_lock (X);
read_item (X);
X:=X+Y;
write_item (X);
unlock (X);
By C.Aruna Devi(DSCASC) 14
Time

Weitere ähnliche Inhalte

Was ist angesagt?

Bruteforce algorithm
Bruteforce algorithmBruteforce algorithm
Bruteforce algorithmRezwan Siam
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFAkunj desai
 
Introduction to NP Completeness
Introduction to NP CompletenessIntroduction to NP Completeness
Introduction to NP CompletenessGene Moo Lee
 
Master method
Master method Master method
Master method Rajendran
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languagesparmeet834
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSAjunnubabu
 
Introduction to tree ds
Introduction to tree dsIntroduction to tree ds
Introduction to tree dsViji B
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translationAkshaya Arunan
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Srimatre K
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automatadeepinderbedi
 
Algorithm paradigms
Algorithm paradigmsAlgorithm paradigms
Algorithm paradigmssuresh5c2
 

Was ist angesagt? (20)

Bruteforce algorithm
Bruteforce algorithmBruteforce algorithm
Bruteforce algorithm
 
P vs NP
P vs NP P vs NP
P vs NP
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
Introduction to NP Completeness
Introduction to NP CompletenessIntroduction to NP Completeness
Introduction to NP Completeness
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
 
Master method
Master method Master method
Master method
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSA
 
First and follow set
First and follow setFirst and follow set
First and follow set
 
Turing machines
Turing machinesTuring machines
Turing machines
 
Combinatorics
CombinatoricsCombinatorics
Combinatorics
 
Introduction to tree ds
Introduction to tree dsIntroduction to tree ds
Introduction to tree ds
 
Arithmetic Expression
Arithmetic ExpressionArithmetic Expression
Arithmetic Expression
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
 
Algorithm paradigms
Algorithm paradigmsAlgorithm paradigms
Algorithm paradigms
 
Iterations and Recursions
Iterations and RecursionsIterations and Recursions
Iterations and Recursions
 

Andere mochten auch

Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Prosanta Ghosh
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Prosanta Ghosh
 
Locking and Concurrency Control
Locking and Concurrency ControlLocking and Concurrency Control
Locking and Concurrency ControlMorgan Tocker
 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Prosanta Ghosh
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Prosanta Ghosh
 
File organization
File organizationFile organization
File organizationGokul017
 
Dbms ii mca-ch1-ch2-intro-datamodel-2013
Dbms ii mca-ch1-ch2-intro-datamodel-2013Dbms ii mca-ch1-ch2-intro-datamodel-2013
Dbms ii mca-ch1-ch2-intro-datamodel-2013Prosanta Ghosh
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Prosanta Ghosh
 
Dbms ii mca-ch9-transaction-processing-2013
Dbms ii mca-ch9-transaction-processing-2013Dbms ii mca-ch9-transaction-processing-2013
Dbms ii mca-ch9-transaction-processing-2013Prosanta Ghosh
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Prosanta Ghosh
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMSkoolkampus
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Farhan Chishti
 

Andere mochten auch (20)

Concurrency control
Concurrency control Concurrency control
Concurrency control
 
Ch16
Ch16Ch16
Ch16
 
Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
 
Locking and Concurrency Control
Locking and Concurrency ControlLocking and Concurrency Control
Locking and Concurrency Control
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013Dbms ii mca-ch3-er-model-2013
Dbms ii mca-ch3-er-model-2013
 
Locking And Concurrency
Locking And ConcurrencyLocking And Concurrency
Locking And Concurrency
 
Normalization case
Normalization caseNormalization case
Normalization case
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
 
File organization
File organizationFile organization
File organization
 
Dbms ii mca-ch1-ch2-intro-datamodel-2013
Dbms ii mca-ch1-ch2-intro-datamodel-2013Dbms ii mca-ch1-ch2-intro-datamodel-2013
Dbms ii mca-ch1-ch2-intro-datamodel-2013
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
 
Dbms ii mca-ch9-transaction-processing-2013
Dbms ii mca-ch9-transaction-processing-2013Dbms ii mca-ch9-transaction-processing-2013
Dbms ii mca-ch9-transaction-processing-2013
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Data Base Management System
Data Base Management SystemData Base Management System
Data Base Management System
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4
 
3 summary
3 summary3 summary
3 summary
 
File organization
File organizationFile organization
File organization
 

Ähnlich wie Dbms ii mca-ch10-concurrency-control-2013

Chapter 4 Concrruncy controling techniques (1).ppt
Chapter 4 Concrruncy controling techniques (1).pptChapter 4 Concrruncy controling techniques (1).ppt
Chapter 4 Concrruncy controling techniques (1).pptbinaboss24
 
concurrency-control-techniques.ppt
concurrency-control-techniques.pptconcurrency-control-techniques.ppt
concurrency-control-techniques.pptkushvithchinna900
 
5-Chapter Five - Concurrenc.ppt
5-Chapter Five - Concurrenc.ppt5-Chapter Five - Concurrenc.ppt
5-Chapter Five - Concurrenc.pptDadiTesfaye
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control TechniquesRaj vardhan
 
Chapter Three _Concurrency Control Techniques_ETU.ppt
Chapter Three _Concurrency Control Techniques_ETU.pptChapter Three _Concurrency Control Techniques_ETU.ppt
Chapter Three _Concurrency Control Techniques_ETU.ppthaymanot taddesse
 
Adbms 41 transaction control techniques
Adbms 41 transaction control techniquesAdbms 41 transaction control techniques
Adbms 41 transaction control techniquesVaibhav Khanna
 
Concurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingConcurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingMeghaj Mallick
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!Ashish K
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMSkoolkampus
 
Transactions
TransactionsTransactions
Transactionskalyan_bu
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMSMegha Patel
 
Unit 5 rdbms study_material
Unit 5  rdbms study_materialUnit 5  rdbms study_material
Unit 5 rdbms study_materialgayaramesh
 
db unit 4 dbms protocols in transaction
db unit 4 dbms  protocols in transactiondb unit 4 dbms  protocols in transaction
db unit 4 dbms protocols in transactionKumari Naveen
 

Ähnlich wie Dbms ii mca-ch10-concurrency-control-2013 (20)

Unit 6
Unit 6Unit 6
Unit 6
 
Chapter 4 Concrruncy controling techniques (1).ppt
Chapter 4 Concrruncy controling techniques (1).pptChapter 4 Concrruncy controling techniques (1).ppt
Chapter 4 Concrruncy controling techniques (1).ppt
 
concurrency-control-techniques.ppt
concurrency-control-techniques.pptconcurrency-control-techniques.ppt
concurrency-control-techniques.ppt
 
5-Chapter Five - Concurrenc.ppt
5-Chapter Five - Concurrenc.ppt5-Chapter Five - Concurrenc.ppt
5-Chapter Five - Concurrenc.ppt
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Chapter18
Chapter18Chapter18
Chapter18
 
Chapter Three _Concurrency Control Techniques_ETU.ppt
Chapter Three _Concurrency Control Techniques_ETU.pptChapter Three _Concurrency Control Techniques_ETU.ppt
Chapter Three _Concurrency Control Techniques_ETU.ppt
 
concurrency control
concurrency controlconcurrency control
concurrency control
 
Cs501 concurrency
Cs501 concurrencyCs501 concurrency
Cs501 concurrency
 
Adbms 41 transaction control techniques
Adbms 41 transaction control techniquesAdbms 41 transaction control techniques
Adbms 41 transaction control techniques
 
Concurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingConcurrency Control & Deadlock Handling
Concurrency Control & Deadlock Handling
 
2 con control
2 con control2 con control
2 con control
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
Transactions
TransactionsTransactions
Transactions
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Ch16
Ch16Ch16
Ch16
 
concurrency-control
concurrency-controlconcurrency-control
concurrency-control
 
Unit 5 rdbms study_material
Unit 5  rdbms study_materialUnit 5  rdbms study_material
Unit 5 rdbms study_material
 
db unit 4 dbms protocols in transaction
db unit 4 dbms  protocols in transactiondb unit 4 dbms  protocols in transaction
db unit 4 dbms protocols in transaction
 

Kürzlich hochgeladen

eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 

Kürzlich hochgeladen (20)

eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 

Dbms ii mca-ch10-concurrency-control-2013

  • 1. Concurrency Control Techniques Chapter 10 UNIT V By C.Aruna Devi(DSCASC) 1 Data Base Management System [DBMS]
  • 2. Locking Techniques for concurrency control The main technique used to control concurrent execution of transaction are based on the concept of locking data items. A lock is a variable associated with a data item that describes the status of the item with respect to possible operations that can be applied to it. Generally there is one lock for each data item in the database. By C.Aruna Devi(DSCASC) 2
  • 3. Types of locks and system lock tables Binary Locks. Shared/Exclusive (or Read/write) Locks. Conversion of Locks. By C.Aruna Devi(DSCASC) 3
  • 4. Binary Locks. A binary lock can have two states or values: locked and unlocked (or 1 and 0). A distinct lock is associated with each database item X. If the value of the lock on X is 1, item X cannot be accessed by a database operation that request the item. If the value of the lock on X is 0, the item can be accessed when requested. Refer pg 662 Navathe By C.Aruna Devi(DSCASC) 4
  • 5. Binary Lock The following code performs the lock operation: Lock_item(X): B: if LOCK (X) = 0 (*item is unlocked*) then LOCK (X) ← 1 (*lock the item*) else begin wait (until lock (X) = 0) and the lock manager wakes up the transaction); goto B end; By C.Aruna Devi(DSCASC) 5
  • 6. Binary Unlock The following code performs the unlock operation: Unlock_item(X): LOCK (X) ← 0 (*unlock the item*) if any transactions are waiting then wake up one of the waiting transactions; By C.Aruna Devi(DSCASC) 6
  • 7. Shared/Exclusive (or Read/write) Locks. The following code performs the read lock operation: (read_lock is also called shared_locked) read_lock(X): B: if LOCK (X) = “unlocked” then begin LOCK (X) ← “read-locked”; no_of_reads (X) ← 1; end else if LOCK (X) ← “read-locked” then no_of_reads (X) ← no_of_reads (X) +1 else begin wait (until LOCK (X) = “unlocked” and the lock manager wakes up the transaction); goto B end; By C.Aruna Devi(DSCASC) 7
  • 8. Shared/Exclusive (or Read/write) Locks. The following code performs the write lock operation: (write_lock is also called exclusive_locked) write_lock(X): B: if LOCK (X) = “unlocked” then LOCK (X) ← “write-locked”; else begin wait (until LOCK (X) = “unlocked” and the lock manager wakes up the transaction); goto B end; By C.Aruna Devi(DSCASC) 8
  • 9. Shared/Exclusive (or Read/write) Locks. The following code performs the unlock operation: unlock(X): if LOCK (X) = “write-locked” then begin LOCK (X) ← “unlocked”; wakes up one of the transactions, if any end else if LOCK (X) ← “read-locked” then begin no_of_reads (X) ← no_of_reads (X) -1 if no_of_reads (X) = 0 then begin LOCK (X) = “unlocked”; wake up one of the transactions, if any end end; By C.Aruna Devi(DSCASC) 9
  • 10. Conversion of Lock Two Phases: (a) Locking (Growing) (b) Unlocking (Shrinking): Locking (Growing) Phase: A transaction applies locks (read or write) on desired data items one at a time. Unlocking (Shrinking) Phase: A transaction unlocks its locked data items one at a time. Requirement: For a transaction these two phases must be mutually exclusively, that is, during locking phase unlocking phase must not start and during unlocking phase locking phase must not begin. Lock Conversion: That is, transaction that already holds a lock on item X is allowed under certain conditions to convert the lock from one locked state to another. By C.Aruna Devi(DSCASC) 11
  • 11. Conversion of Lock For eg: It is possible for a transaction T to issue a read_lock(X) and then later on to upgrade the lock by issuing a write_lock(X) operation. If T is the only transaction holding a read lock on X at the time it issues the write_lock(X) operation, the lock can be upgraded, otherwise the transaction must wait. It is also possible for a transaction T to issue a write_lock(X) and then later on to downgrade the lock by issuing a read_lock(X) operation. By C.Aruna Devi(DSCASC) 12
  • 12. Conversion of Lock Two-Phase Locking Techniques: The algorithm T1 T2 Result read_lock (Y); read_lock (X); Initial values: X=20; Y=30 read_item (Y); read_item (X); Result of serial execution unlock (Y); unlock (X); T1 followed by T2 write_lock (X); Write_lock (Y); X=50, Y=80. read_item (X); read_item (Y); Result of serial execution X:=X+Y; Y:=X+Y; T2 followed by T1 write_item (X); write_item (Y); X=70, Y=50 unlock (X); unlock (Y); By C.Aruna Devi(DSCASC) 13
  • 13. Conversion of Lock Two-Phase Locking Techniques: The algorithm T1 T2 Result read_lock (Y); X=50; Y=50 read_item (Y); Nonserializable because it. unlock (Y); violated two-phase policy. read_lock (X); read_item (X); unlock (X); write_lock (Y); read_item (Y); Y:=X+Y; write_item (Y); unlock (Y); write_lock (X); read_item (X); X:=X+Y; write_item (X); unlock (X); By C.Aruna Devi(DSCASC) 14 Time