익명 사용자
로그인하지 않음
토론
기여
계정 만들기
로그인
IT 위키
검색
Multiple Granularity Locking
편집하기
IT 위키
이름공간
문서
토론
더 보기
더 보기
문서 행위
읽기
편집
원본 편집
역사
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
'''Multiple Granularity Locking''' is a concurrency control mechanism used in database systems to improve performance and manage locks at various levels of granularity, such as tuples, pages, tables, or the entire database. By allowing transactions to lock data items at different granular levels, this method optimizes the balance between concurrency and locking overhead. ==Key Concepts== *'''Lock Granularity:''' Refers to the size of the data item on which a lock is applied, ranging from fine-grained (individual records) to coarse-grained (entire tables). *'''Intention Locks:''' Special locks used to indicate a transaction's intention to acquire more restrictive locks at a lower level. *'''Lock Modes:''' Different types of locks that specify the level of access, including shared locks (S), exclusive locks (X), intention shared (IS), intention exclusive (IX), shared and intention exclusive (SIX). ==Lock Modes and Compatibility== Multiple granularity locking introduces additional lock modes beyond the standard shared and exclusive locks: *'''Intention Shared (IS):''' Indicates intention to acquire shared locks on lower-level nodes. *'''Intention Exclusive (IX):''' Indicates intention to acquire exclusive locks on lower-level nodes. *'''Shared and Intention Exclusive (SIX):''' A combination of a shared lock at the current level and intention exclusive locks on lower levels. *'''Shared (S):''' Allows reading but not writing of a data item. *'''Exclusive (X):''' Allows both reading and writing of a data item. The compatibility matrix for these lock modes is as follows: {| class="wikitable" ! !!IS!!IX!!S!!SIX!!X |- !IS |Yes||Yes||Yes||Yes||No |- !IX |Yes||Yes||No||No||No |- !S |Yes||No||Yes||No||No |- !SIX |Yes||No||No||No||No |- !X |No||No||No||No||No |} ==How Multiple Granularity Locking Works== #'''Hierarchy Structure:''' The database is structured as a hierarchy, such as database → table → page → record. #'''Intention Locks:''' Transactions acquire intention locks on higher-level nodes before acquiring actual locks on lower-level nodes. #'''Locking Protocol:''' Transactions follow a protocol to request locks in a specific order to prevent deadlocks and ensure serializability. #'''Lock Compatibility Checks:''' Before granting a lock, the system checks the compatibility matrix to ensure no conflicting locks are held by other transactions. ==Example== Suppose a transaction wants to update a record in a table: #The transaction acquires an '''IX''' lock on the database. #Acquires an '''IX''' lock on the table. #Acquires an '''X''' lock on the specific record. Another transaction wanting to read the entire table would: #Acquire an '''IS''' lock on the database. #Acquire an '''S''' lock on the table. Since '''IX''' and '''S''' locks are incompatible at the table level, the second transaction must wait until the first transaction releases its locks, preventing inconsistent reads. ==Advantages== *'''Improved Concurrency:''' Allows multiple transactions to access different levels of data without unnecessary blocking. *'''Reduced Locking Overhead:''' Minimizes the number of locks required by locking larger granules when appropriate. *'''Deadlock Prevention:''' Structured locking protocol reduces the likelihood of deadlocks. ==Limitations== *'''Complexity:''' Implementation and management of multiple lock modes and intention locks add complexity. *'''Overhead:''' Maintaining lock hierarchies and performing compatibility checks can introduce overhead. *'''Potential for Reduced Concurrency:''' Coarse-grained locks can still limit concurrency if not managed properly. ==Applications== Multiple granularity locking is widely used in: *'''Database Management Systems:''' Relational databases like Oracle, SQL Server, and DB2 to manage transaction concurrency. *'''Distributed Systems:''' Coordinating access to shared resources in distributed computing environments. ==Related Concepts and See Also== *[[Concurrency Control]] *[[Lock-Based Protocols]] *[[Two-Phase Locking]] *[[Deadlock]] *[[Transaction Management]] *[[Isolation Levels]] *[[Intention Locks]] [[Category:Database]]
요약:
IT 위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는
IT 위키:저작권
문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다.
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
둘러보기
둘러보기
대문
최근 바뀜
광고
위키 도구
위키 도구
특수 문서 목록
문서 도구
문서 도구
사용자 문서 도구
더 보기
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
문서 기록