Previous Topic: Logical LocksNext Topic: Logical Area Locks


Types of Locks

Lock Modes

Each logical lock has an associated lock mode. The mode of the lock determines whether the lock conflicts with other locks already held on the resource and with locks subsequently requested by other transactions.

The following types of locks (lock modes) are used for both area and record locks:

Mode

Identifier

Description

Share

S

Typically used to guarantee that no updates are made to data while a transaction is accessing it. A share lock is compatible with other share locks but not with exclusive locks. A share lock placed on an area implies a share lock on each record within the area.

Exclusive

X

Typically placed on a resource to protect transactions from accessing data that is being updated by the issuing transaction. An exclusive lock is incompatible with both share and other exclusive locks. An exclusive lock placed on an area implies an exclusive lock on all records within the area.

Null-lock

NL

A null-lock is a special type of lock which is placed on a record to signify a notify lock and on an area to signify transient retrieval access. Null-locks provide no protection against concurrent access.

Intent Locks on Areas

The following types of locks are placed only on areas:

Mode

Identifier

Description

Intent share

IS

Allows share (S) locks to be placed on records within the area.

Intent exclusive

IX

Allows exclusive (X) locks to be placed on records within the area.

Update intent exclusive

UIX

Allows exclusive locks to be placed on records within the area by the issuing transaction, but not by other transactions.

In addition to the above lock modes, the following lock mode has been provided for but is currently not used:

Compatibility of Locks

For two transactions running within the same DC/UCF system to access the same area or row concurrently, their lock types must be compatible. When two transactions attempt to set locks that are not compatible, the first transaction to set a lock causes the second transaction to wait until the resource is freed.

Note: CA IDMS ensures that a transaction does not compete with itself for locks.

Compatibility Chart

The following chart shows which lock modes are compatible and which are incompatible. The plus sign (+) indicates a situation in which two lock modes are compatible. The minus sign (-) indicates a situation in which two lock modes are incompatible.

 

NL

IS

IX

S

U

UIX

X

NL

+

+

+

+

+

+

+

IS

+

+

+

+

+

+

-

IX

+

+

+

-

-

-

-

S

+

+

-

+

+

-

-

U

+

+

-

+

-

-

-

UIX

+

+

-

-

-

-

-

X

+

-

-

-

-

-

-

Example

If TRANSACTION1 holds a share (S) lock on an area, TRANSACTION2 can set a null-lock (NL), intent-share (IS), share (S), or update (U) lock on the same area.