ENCh18
-
Upload
yazanalomari -
Category
Documents
-
view
216 -
download
0
Transcript of ENCh18
-
7/25/2019 ENCh18
1/46
-
7/25/2019 ENCh18
2/46
Chapter 18
Concurrency ControlTechniques
Copyright 2004 Pearson Education, Inc.
-
7/25/2019 ENCh18
3/46
Copyright 2004 Ramez Elmasri and Shamant !a"athe
Elmasri/Navathe, Fundamentals of Database ystems, Fourth Edition Chapter 18-3
Chapter 18 Outline
Databases Concurrency Control
# Purpose o$ Concurrency Control
2 %&o'Phase locing
( )imitations o$ CC*s
+ Inde )ocing
- )oc Compatiility *atri/ )oc ranularity
-
7/25/2019 ENCh18
4/46
Copyright 2004 Ramez Elmasri and Shamant !a"athe
Elmasri/Navathe, Fundamentals of Database ystems, Fourth Edition Chapter 18-4
Database Concurrency Control
1 Purpose of Concurrency Control
1 %o en$orce Isolation through mutual eclusion3 amongcon$licting transactions.
1 %o preser"e dataase consistency through consistencypreser"ing eecution o$ transactions.
1 %o resol"e read'&rite and &rite'&rite con$licts.
Eample In concurrent eecution en"ironment i$ %#con$licts &ith %2 o"er a data item 5, then the eistingconcurrency control decides i$ %# or %2 should get the 5and i$ the other transaction is rolled'ac or &aits.
-
7/25/2019 ENCh18
5/46
Copyright 2004 Ramez Elmasri and Shamant !a"athe
Elmasri/Navathe, Fundamentals of Database ystems, Fourth Edition Chapter 18-5
Database Concurrency Control
Two-Phase Locking Techniues
)ocing is an operation &hich secures a3 permission to
Read or 3 permission to 6rite a data item $or a transaction.
Eample )oc 73. 8ata item 7 is loced in ehal$ o$ there9uesting transaction.
:nlocing is an operation &hich remo"es these permissions
$rom the data item. Eample :nloc 73. 8ata item 7 ismade a"ailale to all other transactions.
)oc and :nloc are 5tomic operations.
-
7/25/2019 ENCh18
6/46
Copyright 2004 Ramez Elmasri and Shamant !a"athe
Elmasri/Navathe, Fundamentals of Database ystems, Fourth Edition Chapter 18-!
Database Concurrency Control
Two-Phase Locking Techniues" #ssential co$ponents
%&o locs modes a3 shared read3 and 3 eclusi"e &rite3.
Shared mode shared loc 73. *ore than one transaction can applyshare loc on 7 $or reading its "alue ut no &rite loc can e applied
on 7 y any other transaction.Eclusi"e mode 6rite loc 73. ;nly one &rite loc on 7 can eistat any time and no shared loc can e applied y any other transactionon 7.
Con$lict matri
Read 6riteRead
6rite
!
!!