SlideShare a Scribd company logo
Optimistic Algorithms & Concurrency Control Algorithms 
1 
Shounak Katyayan Advances in Operating System Design 
Shounak Katyayan 
M. Tech CSE : 2014 - 15
INDEX 
•Optimistic Algorithms 
–Kung Robinson Algorithm 
•Concurrency Control Algorithms 
–Completely Centralized Algorithm 
–Centralized Locking Algorithm 
–INGRES’ Primary-Site Locking Algorithm 
–Two-Phase Locking Algorithm 
M. Tech CSE : 2014 - 15 
Shounak Katyayan Advances in Operating System Design 
2
Optimistic Algorithms 
•Based on the assumption 
“conflicts do not occur during execution time” 
3 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Optimistic Algorithms 
•Thus, 
No synchronization is performed when a transaction is executed. 
4 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Optimistic Algorithms 
•However, 
A check is performed at the end of the transaction (to ensure no conflicts have occurred) 
5 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Optimistic Algorithms 
•If conflict == true 
–Transaction aborted 
•Else 
–Commit Transaction 
6 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Optimistic Algorithms 
•Since conflicts do not occur very often, this algorithm is very efficient compared to other locking algorithms. 
7 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Kung-Robinson Algorithm 
•H. T. KUNG and JOHN T. ROBINSON were the first to propose an optimistic method for concurrency control. 
•The optimistic situation for this algorithm happens when conflicts are unlikely to happen; the system consists mainly read-only transactions (such as a query dominant (powerful) system) 
•Basic Idea: No synchronization check is performed during transaction processing time, however, a validation is performed to make sure that no conflicts occurred. If a conflict is found, the tentative write is discarded and the transaction is restarted. 
8 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
The Algorithm (Kung-Robinson) 
•Divided into three phases : 
Read Phase Validation Phase Write Phase 
9 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
The Algorithm (Kung-Robinson) 
•Divided into three phases : 
Read Phase Validation Phase Write Phase 
10 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
data objects are read, the intended computation of the transaction is done, and writes are made on a temporary storage.
The Algorithm (Kung-Robinson) 
•Divided into three phases : 
Read Phase Validation Phase Write Phase 
11 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
check to see if writes made by the transaction violate the consistency of the database.
The Algorithm (Kung-Robinson) 
•Divided into three phases : 
Read Phase Validation Phase Write Phase 
12 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
If the check finds out any conflicts, the data in the temporary storage will be discarded. Otherwise, the write phase will write the data into the database.
The Algorithm (Kung-Robinson) 
•Divided into three phases : 
Read Phase Validation Phase Write Phase 
13 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
If the validation phase passes ok, write will be performed to the database. If the validation phase fails to pass, all temporary written data will be aborted.
The Algorithm (Kung-Robinson) 
•Validation Phase (can be described as) 
–T: a transaction 
–ts: the highest sequence number at the start of T 
–tf: the highest sequence number at the beginning of its validation phase 
14 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
valid:=true; 
for t:=ts+1 to tf do 
if (writeset(t) & readset[T] != {} ) then 
valid :=false; 
if valid then {write phase; increment counter, assign T a sequence number}
Concurrency Control Algorithms 
•Fully replicated database systems i.e. 
“data objects are replicated at all sites” 
15 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Completely Centralized Algorithm 
16 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
A site is designated as the central site.
Completely Centralized Algorithm 
17 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Transaction: 
Update 
Account Balance #B=78000 
Transaction at site A occurs.
Completely Centralized Algorithm 
18 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Transaction: 
Update 
Account Balance #B=78000 
Transaction is forward to the central site for execution.
Completely Centralized Algorithm 
19 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Serial execution effect.
Completely Centralized Algorithm 
20 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Serial execution effect.
Completely Centralized Algorithm 
21 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Serial execution effect.
Completely Centralized Algorithm 
22 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Serial execution effect.
Completely Centralized Algorithm 
23 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Serial execution effect.
Completely Centralized Algorithm 
24 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Perform update message broadcast to all other sites with sequence number. 
Perform Update 
Perform Update 
Perform Update 
Perform Update 
Perform Update
Completely Centralized Algorithm 
25 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
T1 
T2 
T3 
T4 
T5 
Central Site 
Site A 
Site B 
Site C 
Site D 
Site E 
Messages processed then updates applied to local databases. 
Perform Update 
Perform Update 
Perform Update 
Perform Update 
Perform Update
Centralized Locking Algorithm 
•Transactions processed in distributed manner 
•Central site is requested with a lock request message for data objects to be accessed 
•Site responds with a lock grant message with a sequence number 
•Queue for each data object 
•Site executes its transaction after receiving lock grant and broadcasts perform update after which the central site releases all locks 
26 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Centralized Locking Algorithm 
27 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Many Sites with centralized lock management 
Central Site
Centralized Locking Algorithm 
28 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Transactions processed at their home site (distributed manner).
Centralized Locking Algorithm 
29 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Site requests locks via lock request message for the data objects when it needs to update database 
lock request 
message 
O1 
O2 
O7 (objects)
Centralized Locking Algorithm 
30 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Central site responds with a lock grant message (if all locks can be granted) 
lock grant 
message 
O1 
O2 
O7 (objects) 
O3 
O4 
O5 
O6 
O8 
O9
Centralized Locking Algorithm 
31 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Site executes its transaction after receiving lock grant 
O1 
O2 
O7 (objects) 
O3 
O4 
O5 
O6 
O8 
O9
Centralized Locking Algorithm 
32 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Site broadcasts perform update message 
O1 
O2 
O7 (objects) 
Perform Update 
Perform Update 
Perform Update 
Perform Update 
Perform Update O3 O4 O5 O6 O8 O9
Centralized Locking Algorithm 
33 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
Central site releases all locks when it receives perform update message 
O1 
O2 
O7 (objects) 
Perform Update 
Perform Update 
Perform Update 
Perform Update 
Perform Update 
O3 
O4 
O5 
O6 
O8 
O9
INGRES’ Primary-Site Locking Algorithm 
•Based on primary site method 
•Lock management distributed among all the sites 
•Each object of database designated with a single primary site 
34 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Two Phase Locking (2PL) Algorithm 
•Two-phase locking protocol 
– Each transaction is executed in two phases 
∗ Growing phase: the transaction obtains locks 
∗ Shrinking phase: the transaction releases locks 
35 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15 
The lock point is the moment when transitioning from the growing phase to the shrinking phase
Two Phase Locking (2PL) Algorithm 
•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 
36 
Shounak Katyayan Advances in Operating System Design 
M. Tech CSE : 2014 - 15
Optimistic Algorithms & Concurrency Control Algorithms 
37 
Shounak Katyayan Advances in Operating System Design 
Shounak Katyayan 
M. Tech CSE : 2014 - 15 
Thank You !!!

More Related Content

What's hot (20)

PPTX
Turing machine
HimanshuSirohi6
 
PPTX
Timestamp based protocol
Vincent Chu
 
PDF
Requirement analysis and UML modelling in Software engineering
snehalkulkarni74
 
PPTX
Automata theory - NFA to DFA Conversion
Akila Krishnamoorthy
 
PPT
Np complete
Dr. C.V. Suresh Babu
 
PDF
Bayesian networks in AI
Byoung-Hee Kim
 
PPTX
NLP_KASHK:Evaluating Language Model
Hemantha Kulathilake
 
PPTX
Round Robin Algorithm.pptx
Sanad Bhowmik
 
PPTX
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 
PDF
TOC 1 | Introduction to Theory of Computation
Mohammad Imam Hossain
 
PPTX
NLP_KASHK:Parsing with Context-Free Grammar
Hemantha Kulathilake
 
PPT
Dynamic pgmming
Dr. C.V. Suresh Babu
 
PDF
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
PPT
Chapter 6 - Process Synchronization
Wayne Jones Jnr
 
PPT
5 csp
Mhd Sb
 
PPT
Rule Based System
Suresh Sambandam
 
PPTX
Pumping lemma for regular set h1
Rajendran
 
PPTX
NLP_KASHK:Context-Free Grammar for English
Hemantha Kulathilake
 
PPTX
Round robin scheduling
Raghav S
 
Turing machine
HimanshuSirohi6
 
Timestamp based protocol
Vincent Chu
 
Requirement analysis and UML modelling in Software engineering
snehalkulkarni74
 
Automata theory - NFA to DFA Conversion
Akila Krishnamoorthy
 
Bayesian networks in AI
Byoung-Hee Kim
 
NLP_KASHK:Evaluating Language Model
Hemantha Kulathilake
 
Round Robin Algorithm.pptx
Sanad Bhowmik
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 
TOC 1 | Introduction to Theory of Computation
Mohammad Imam Hossain
 
NLP_KASHK:Parsing with Context-Free Grammar
Hemantha Kulathilake
 
Dynamic pgmming
Dr. C.V. Suresh Babu
 
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
Chapter 6 - Process Synchronization
Wayne Jones Jnr
 
5 csp
Mhd Sb
 
Rule Based System
Suresh Sambandam
 
Pumping lemma for regular set h1
Rajendran
 
NLP_KASHK:Context-Free Grammar for English
Hemantha Kulathilake
 
Round robin scheduling
Raghav S
 

Similar to Optimistic Algorithm and Concurrency Control Algorithm (20)

PPTX
Operating Systems- Dr.G.Sumathi AI & DS, KNCET
sumathiganesan4
 
PPTX
Concurrent control
Felix Makundi
 
PDF
Distributed Operating System_1
Dr Sandeep Kumar Poonia
 
DOCX
Bca2010 – operating system
smumbahelp
 
PPTX
Concurrency Control in Distributed Systems.pptx
MArshad35
 
PDF
Os notes 1_5
NagarajMatheswaran
 
PPT
chapter 1 intoduction to operating system
Siddhi Viradiya
 
PPTX
Distribution transparency and Distributed transaction
shraddha mane
 
PPT
Operating system lecture1
AhalyaSri
 
PDF
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
vtunotesbysree
 
PPT
Distributed system TimeNState-Tanenbaum.ppt
TantraNathjha1
 
PDF
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
Monica Sabharwal
 
PDF
Unit I OS.pdf
UmaYadav45
 
DOCX
Operating System And Data Storage
amitymbaassignment
 
PPTX
Transactions and Concurrency Control
Dilum Bandara
 
PPTX
bankers-algorithm2.pptx
jamilmalik19
 
PDF
Computer science with seats are there in iit for FAIR USE for purpose such a ...
KalbindraPrajapati
 
PDF
Operating System Multiple Choice Questions
Shusil Baral
 
PPTX
OS UNIT1.pptx
DHANABALSUBRAMANIAN
 
Operating Systems- Dr.G.Sumathi AI & DS, KNCET
sumathiganesan4
 
Concurrent control
Felix Makundi
 
Distributed Operating System_1
Dr Sandeep Kumar Poonia
 
Bca2010 – operating system
smumbahelp
 
Concurrency Control in Distributed Systems.pptx
MArshad35
 
Os notes 1_5
NagarajMatheswaran
 
chapter 1 intoduction to operating system
Siddhi Viradiya
 
Distribution transparency and Distributed transaction
shraddha mane
 
Operating system lecture1
AhalyaSri
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
vtunotesbysree
 
Distributed system TimeNState-Tanenbaum.ppt
TantraNathjha1
 
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
Monica Sabharwal
 
Unit I OS.pdf
UmaYadav45
 
Operating System And Data Storage
amitymbaassignment
 
Transactions and Concurrency Control
Dilum Bandara
 
bankers-algorithm2.pptx
jamilmalik19
 
Computer science with seats are there in iit for FAIR USE for purpose such a ...
KalbindraPrajapati
 
Operating System Multiple Choice Questions
Shusil Baral
 
OS UNIT1.pptx
DHANABALSUBRAMANIAN
 
Ad

Recently uploaded (20)

PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Day2 B2 Best.pptx
helenjenefa1
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
Ad

Optimistic Algorithm and Concurrency Control Algorithm

  • 1. Optimistic Algorithms & Concurrency Control Algorithms 1 Shounak Katyayan Advances in Operating System Design Shounak Katyayan M. Tech CSE : 2014 - 15
  • 2. INDEX •Optimistic Algorithms –Kung Robinson Algorithm •Concurrency Control Algorithms –Completely Centralized Algorithm –Centralized Locking Algorithm –INGRES’ Primary-Site Locking Algorithm –Two-Phase Locking Algorithm M. Tech CSE : 2014 - 15 Shounak Katyayan Advances in Operating System Design 2
  • 3. Optimistic Algorithms •Based on the assumption “conflicts do not occur during execution time” 3 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 4. Optimistic Algorithms •Thus, No synchronization is performed when a transaction is executed. 4 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 5. Optimistic Algorithms •However, A check is performed at the end of the transaction (to ensure no conflicts have occurred) 5 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 6. Optimistic Algorithms •If conflict == true –Transaction aborted •Else –Commit Transaction 6 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 7. Optimistic Algorithms •Since conflicts do not occur very often, this algorithm is very efficient compared to other locking algorithms. 7 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 8. Kung-Robinson Algorithm •H. T. KUNG and JOHN T. ROBINSON were the first to propose an optimistic method for concurrency control. •The optimistic situation for this algorithm happens when conflicts are unlikely to happen; the system consists mainly read-only transactions (such as a query dominant (powerful) system) •Basic Idea: No synchronization check is performed during transaction processing time, however, a validation is performed to make sure that no conflicts occurred. If a conflict is found, the tentative write is discarded and the transaction is restarted. 8 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 9. The Algorithm (Kung-Robinson) •Divided into three phases : Read Phase Validation Phase Write Phase 9 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 10. The Algorithm (Kung-Robinson) •Divided into three phases : Read Phase Validation Phase Write Phase 10 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 data objects are read, the intended computation of the transaction is done, and writes are made on a temporary storage.
  • 11. The Algorithm (Kung-Robinson) •Divided into three phases : Read Phase Validation Phase Write Phase 11 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 check to see if writes made by the transaction violate the consistency of the database.
  • 12. The Algorithm (Kung-Robinson) •Divided into three phases : Read Phase Validation Phase Write Phase 12 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 If the check finds out any conflicts, the data in the temporary storage will be discarded. Otherwise, the write phase will write the data into the database.
  • 13. The Algorithm (Kung-Robinson) •Divided into three phases : Read Phase Validation Phase Write Phase 13 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 If the validation phase passes ok, write will be performed to the database. If the validation phase fails to pass, all temporary written data will be aborted.
  • 14. The Algorithm (Kung-Robinson) •Validation Phase (can be described as) –T: a transaction –ts: the highest sequence number at the start of T –tf: the highest sequence number at the beginning of its validation phase 14 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 valid:=true; for t:=ts+1 to tf do if (writeset(t) & readset[T] != {} ) then valid :=false; if valid then {write phase; increment counter, assign T a sequence number}
  • 15. Concurrency Control Algorithms •Fully replicated database systems i.e. “data objects are replicated at all sites” 15 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 16. Completely Centralized Algorithm 16 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Central Site Site A Site B Site C Site D Site E A site is designated as the central site.
  • 17. Completely Centralized Algorithm 17 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Central Site Site A Site B Site C Site D Site E Transaction: Update Account Balance #B=78000 Transaction at site A occurs.
  • 18. Completely Centralized Algorithm 18 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Central Site Site A Site B Site C Site D Site E Transaction: Update Account Balance #B=78000 Transaction is forward to the central site for execution.
  • 19. Completely Centralized Algorithm 19 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Serial execution effect.
  • 20. Completely Centralized Algorithm 20 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Serial execution effect.
  • 21. Completely Centralized Algorithm 21 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Serial execution effect.
  • 22. Completely Centralized Algorithm 22 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Serial execution effect.
  • 23. Completely Centralized Algorithm 23 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Serial execution effect.
  • 24. Completely Centralized Algorithm 24 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Perform update message broadcast to all other sites with sequence number. Perform Update Perform Update Perform Update Perform Update Perform Update
  • 25. Completely Centralized Algorithm 25 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 T1 T2 T3 T4 T5 Central Site Site A Site B Site C Site D Site E Messages processed then updates applied to local databases. Perform Update Perform Update Perform Update Perform Update Perform Update
  • 26. Centralized Locking Algorithm •Transactions processed in distributed manner •Central site is requested with a lock request message for data objects to be accessed •Site responds with a lock grant message with a sequence number •Queue for each data object •Site executes its transaction after receiving lock grant and broadcasts perform update after which the central site releases all locks 26 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 27. Centralized Locking Algorithm 27 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Many Sites with centralized lock management Central Site
  • 28. Centralized Locking Algorithm 28 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Transactions processed at their home site (distributed manner).
  • 29. Centralized Locking Algorithm 29 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Site requests locks via lock request message for the data objects when it needs to update database lock request message O1 O2 O7 (objects)
  • 30. Centralized Locking Algorithm 30 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Central site responds with a lock grant message (if all locks can be granted) lock grant message O1 O2 O7 (objects) O3 O4 O5 O6 O8 O9
  • 31. Centralized Locking Algorithm 31 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Site executes its transaction after receiving lock grant O1 O2 O7 (objects) O3 O4 O5 O6 O8 O9
  • 32. Centralized Locking Algorithm 32 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Site broadcasts perform update message O1 O2 O7 (objects) Perform Update Perform Update Perform Update Perform Update Perform Update O3 O4 O5 O6 O8 O9
  • 33. Centralized Locking Algorithm 33 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 Central site releases all locks when it receives perform update message O1 O2 O7 (objects) Perform Update Perform Update Perform Update Perform Update Perform Update O3 O4 O5 O6 O8 O9
  • 34. INGRES’ Primary-Site Locking Algorithm •Based on primary site method •Lock management distributed among all the sites •Each object of database designated with a single primary site 34 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 35. Two Phase Locking (2PL) Algorithm •Two-phase locking protocol – Each transaction is executed in two phases ∗ Growing phase: the transaction obtains locks ∗ Shrinking phase: the transaction releases locks 35 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15 The lock point is the moment when transitioning from the growing phase to the shrinking phase
  • 36. Two Phase Locking (2PL) Algorithm •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 36 Shounak Katyayan Advances in Operating System Design M. Tech CSE : 2014 - 15
  • 37. Optimistic Algorithms & Concurrency Control Algorithms 37 Shounak Katyayan Advances in Operating System Design Shounak Katyayan M. Tech CSE : 2014 - 15 Thank You !!!