Information Technology Reference
In-Depth Information
Algorithm 2.1
Function
fix
.p/
if
page p is not in the buffer
then
if
all buffer frames are occupied
then
select a buffered unfixed page q to be evicted
if
page q is modified
then
flush page q to its disk address
end if
assign the buffer frame of page q to page p
else
assign some unoccupied buffer frame to page p
end if
fetch page p from its disk address to the frame
create a buffer control block
clear the modified-bit
initialize fixcount as zero
else
get the address of the buffer frame of p
end if
increment the fixcount
return the address of the frame
An implementation of the call
fix
.p/ is given as Algorithm
2.1
.Ifallbuffer
frames are occupied and the pages fixed (i.e., all the fixcounts are non-zero), the
process thread performing the call must wait until the fixcount of some buffered
page comes down to zero. The call
unfix
.p/ decrements the fixcount of page p by
one.
2.4
Database States
The contents of the page on disk at the disk address of page p is called the
disk
version
of page p.The
buffer version
of a buffered page p is the contents of p in the
buffer. The buffer version of a modified page differs from the disk version until the
page is flushed from the buffer onto disk. In flushing onto disk, the disk version is
overwritten by the buffer version. The
current version
of page p is the buffer version
if p is buffered and the disk version otherwise.
The
disk version
of a physical database is the collection of disk versions of its
pages. The
state
or
current version
of a physical database at a certain time is the
contents of the current versions of its pages at that time.
The
disk version
of a logical database is the collection of tuples contained in
the disk versions of the data pages of the underlying physical database. The
state
or
current version
of a logical database is the set of tuples in its relations, i.e., the
tuples in the current versions of the data pages in the underlying physical database.