chap 20. lock architecture
DESCRIPTION
Chap 20. Lock Architecture. Written by Yong-soon Kwon Summerized By Sungchan Park @ IDS Lab. 2008-07-25. Lock. Lock Ensure data consistency all resources in DB in parallel or concurrent executing environment Enqueue Long term lock mechanism(table, …) Latch - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/1.jpg)
Chap 20. Lock ArchitectureChap 20. Lock Architecture
Written by Yong-soon Kwon
Summerized By Sungchan Park @ IDS Lab.
2008-07-25
![Page 2: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/2.jpg)
Copyright 2008 by CEBT
LockLock
Lock
Ensure data consistency all resources in DB
in parallel or concurrent executing environment
– Enqueue
Long term lock mechanism(table, …)
– Latch
Short term lock mechanism(memory, …)
Center for E-Business Technology
![Page 3: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/3.jpg)
Copyright 2008 by CEBT
EnqueueEnqueue
Enqueue
Acquires lock for long time
Used in managing shared resources
Served by Oracle kernel
Enqueue types
– Managed Enqueue
Oracle DB level
– Client Enqueue
DML
Type
TM : table level lock
TX : row level lock
Center for E-Business Technology
![Page 4: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/4.jpg)
Copyright 2008 by CEBT
Enqueue: Enqueue ModeEnqueue: Enqueue Mode
Enqueue Mode
RS : Lmode 2
– Lock for rows selected by query
RX : Lmode 3
– Table lock when DML
S : Lmode 4
– Lock for reference integrity
SRX : Lmode 5
– On delete cascade
X : Lmode 6
– Row lock when DML
Center for E-Business Technology
![Page 5: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/5.jpg)
Copyright 2008 by CEBT
Enqueue Mode CompatibilityEnqueue Mode Compatibility
Center for E-Business Technology
RS RX S SRX X
RS o o o o x
RX o o x x x
S o x o x x
SRX o x x x x
X x x x x x
![Page 6: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/6.jpg)
Copyright 2008 by CEBT
Resource TableResource Table
Center for E-Business Technology
![Page 7: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/7.jpg)
Copyright 2008 by CEBT
Resource StructureResource Structure
Resource Structure Identifier
– <Enqueue Type-ID1-ID2>
Owner
– Sessions own this resource
Waiter
– Sessions wait this resource
Converter
Center for E-Business Technology
![Page 8: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/8.jpg)
Copyright 2008 by CEBT
Enqueue Operation ScenarioEnqueue Operation Scenario
Center for E-Business Technology
![Page 9: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/9.jpg)
Copyright 2008 by CEBT
Checking EnqueueChecking Enqueue
Center for E-Business Technology
![Page 10: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/10.jpg)
Copyright 2008 by CEBT
LatchLatch
Latch
Acquires lock for short time
Ensure data consistency on memory
Fast, low cost
Type
– Solitary latch
– Latch set
Parent latch + Child latch
Center for E-Business Technology
![Page 11: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/11.jpg)
Copyright 2008 by CEBT
Acquiring LatchAcquiring Latch
Acquring latch
Willing to wait
No wait
Latch spin
Yield CPU to other process
– not deleting process context(sleeping)
Center for E-Business Technology
![Page 12: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/12.jpg)
Copyright 2008 by CEBT
Latch ScenarioLatch Scenario
Center for E-Business Technology
![Page 13: Chap 20. Lock Architecture](https://reader036.vdocuments.us/reader036/viewer/2022081517/56815881550346895dc5e2a0/html5/thumbnails/13.jpg)
Copyright 2008 by CEBT
Checking Latch with ContentionChecking Latch with Contention
Center for E-Business Technology