Berkeley DB Reference Guide:
Locking Subsystem

PrevRefNext

Standard lock modes

The Berkeley DB locking protocol is described by a conflict matrix. A conflict matrix is an NxN array in which N is the number of different lock modes supported, and the (i, j)th entry of the array indicates whether a lock of mode i conflicts with a lock of mode j. In addition, Berkeley DB defines the type db_lockmode_t, which is the type of a lock mode within a conflict matrix.

(버클리디비 락 프로토콜은 충돌 매트릭스에 의해 설명된다.하나의 충돌매트릭스는 NxN배열이고 여기서 N은 지원되는 서로다른 락모드의 수이고 (i,j)배열엔트리는 락모드 i 가 락모드 j와 충돌하는지를 가르킨다.추가적으로 버클리디비는 충돌매트릭스의 락모드타입을  db_lockmode_t로 정의한다.)

The following is an example of a conflict matrix. The actual conflict matrix used by Berkeley DB to support the underlying access methods is more complicated, but this matrix shows the lock mode relationships available to applications using the Berkeley DB Locking subsystem interfaces directly.

(이하는 충돌매트릭스의 예제이다.실제 액세스메소드에서 사용하는 충돌 매트릭스는 훨씬 복잡하다.그러나 이 예제는 버클리디비 락서브시스템을 직접사용하는 애플리케이션에 적용될수 있는 락 모드 연관성을 보여준다.)

DB_LOCK_NG
not granted (always 0)
DB_LOCK_READ
read (shared)
DB_LOCK_WRITE
write (exclusive)
DB_LOCK_IWRITE
intention to write (shared)
DB_LOCK_IREAD
intention to read (shared)
DB_LOCK_IWR
intention to read and write (shared)

In a conflict matrix, the rows indicate the lock that is held, and the columns indicate the lock that is requested. A 1 represents a conflict (that is, do not grant the lock if the indicated lock is held), and a 0 indicates that it is OK to grant the lock.

(충돌매트릭스에서,행은 락이 잡힌것을 지시하고 열은 락요청을 지시한다.1은 충돌(즉 락이 걸릴수 없다)이고 0은 락이 걸릴수 있다.)

		Notheld	Read    Write	IWrite	IRead	IRW
Notheld		0	0	0	0	0	0
Read*		0	0	1	1	0	1
Write**		0	1	1	1	1	1
Intent Write	0	1	1	0	0	0
Intent Read	0	0	1	0	0	0
Intent RW	0	1	1	0	0	0

*
In this case, suppose that there is a read lock held on an object. A new request for a read lock would be granted, but a request for a write lock would not.

**
In this case, suppose that there is a write lock held on an object. A new request for either a read or write lock would be denied.

PrevRefNext

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.