2-62 IBM Informix OnLine Database Server Administrator’s Guide
How a User Process Acquires a Buffer
Step 4: Read the Page in from Disk
Ifthe requested page must be read from disk, the user process first locates a
usable buffer in theFLRU queues. (Refer to page 2-57.) OnLine selects an
FLRU queue at random and tries to acquire the latch associated with the
queue.If the latch can be acquired, the buffer at the “least-recently used” end
ofthe queue is used. If another process holds the FLRU queue latch, the user
process tries to acquire a latch associated with anotherFLRU queue.
After a usable buffer is found, the buffer is temporarily removed from the
linked list that is theFLRU queue. The user process acquires a latch on the
buffertable hash structure and creates an entry in the buffer table as the page
is read from disk into the buffer.
Steps 5-7: Lock Buffer, Release Lock, and Wake Waiting Processes
Ifthe user process reads the buffer without modifying the data, it releases the
buffer as unmodified. If the user process had acquired the buffer with an
update or exclusive lock, other user processes may be waiting to read the
buffer.
The release of the buffer occurs in steps. First, the releasing user process
acquiresa latch on the buffer table that enables it to modify the buffer entry.
Next, it looks to see if other user processes are sleeping or waiting for this
buffer.If so, the releasing user process wakes the first process in the wait-list
queue that has a compatible lock-access type. The waiting processes are
queued according to priorities that encompass more than just “first-come,
first served” hierarchies. (Otherwise, user processes waiting for exclusive
access could wait forever.)
If no user process in the wait-list queue has a compatible lock-access type,
any user process waiting for that buffer can receive access.
Ifno process is waiting for the buffer, the releasing process tries to releasethe
bufferto the FLRU queue where it was found. If the latch for that FLRU queue
is unavailable, the process tries to acquire a latch for a randomly selected
FLRUqueue. When the FLRU queue latch is acquired, the unmodified buffer
is linked to the “most-recently used” end of the queue.
Afterthe buffer is returned to the FLRU queue or the next user process in the
wait list is awakened, the releasing process removes itself from the user list
bit map for the buffer and decrements the shared-user count by one.