Chap 20. Lock Architecture
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
Chap 20. Lock Architecture
E N D
Presentation Transcript
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 • Short term lock mechanism(memory, …) Center for E-Business Technology
Enqueue • 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
Enqueue: 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
Enqueue Mode Compatibility Center for E-Business Technology
Resource Table Center for E-Business Technology
Resource Structure • Resource Structure • Identifier • <Enqueue Type-ID1-ID2> • Owner • Sessions own this resource • Waiter • Sessions wait this resource • Converter Center for E-Business Technology
Enqueue Operation Scenario Center for E-Business Technology
Checking Enqueue Center for E-Business Technology
Latch • 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
Acquiring 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
Latch Scenario Center for E-Business Technology
Checking Latch with Contention Center for E-Business Technology