TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)

Chapter 10 487
Internal Structures and Techniques
Internal Techniques
Buffer Management
TurboIMAGE/XL maintains a set of buffer partitions in the DBB for all users of an open
database. DBFIND, DBGET, DBUPDATE, DBPUT, and DBDELETE locate a buffer header from
one of these partitions.
Each partition is allocated its own buffer header pool, hash table, and free list. The buffer
header pool is a set of buffer headers allocated for the accessors of its corresponding
partition. The hash table consists of linked lists of buffer header addresses either in use or
ready to be released. The free list is a linked list of available buffer headers. Initially, when
the DBB is created, all of the buffer headers belonging to a partition are linked to a free
list and all the hash table chains are empty. TurboIMAGE/XL uses a two-level hashing
algorithm based on the block number of the data set to determine the partition number as
well as the hash table entry to be used.
When an intrinsic issues a request for a data set block, the buffer manager starts the
search from its hash table entry. If the hash table chain is empty, it acquires a buffer
header from the free list. The buffer header is first allocated from the free list to build the
buffer header for the data set block and link it to its appropriate hash table chain. When
the hash chain, as well as the free list search, is exhausted, the process pauses to wait for
other processes to release buffers then retries the buffer header pool scan.
Locking Internals
Within the DBG is a large lock area that provides space for the entries described below.
Accessor Entries
One of these is created for each successful call to DBOPEN (each access path). Although
located in the lock area, each accessor entry is the link with which TurboIMAGE/XL
controls access to the database. An accessor entry is deleted when DBCLOSE is called for the
access path, and the space is reused.
Set Entries
One of these is created for every data set that is specified in a lock request. Therefore, the
maximum number of set entries is equal to the number of data sets in the database. These
entries are never deleted.
Descriptor Entries
These entries contain the internal form of the lock descriptors specified in locking mode 5
or 6. They disappear when the locks are released (when DBUNLOCK is called) and the space
is reused.
In addition to DBG, the global database lock table, TURBOLKT, is used to avoid deadlocks by
IMAGE/SQL users, and from TurboIMAGE/XL users (if deadlock detection is activated by
DBCONTROL mode 7). The TURBOLKT contains information pertaining to every lock by every
user on the system. In the event of a potential deadlock, an error is returned instead of
causing a system hang.