This interface is displayed after submitting Show data and index from the main interface.
It includes two functions:
Shows a book with the specified ISBN.
Shows the book file data.txt and its index index.txt.
This implementation has the following features:
Assume that the index is too large to be held in memory.
Therefore, index access and maintenance must be done on secondary storage.
A binary searching is applied to the index.
It requires a seek for each step of the binary search on the index.
However, once the byte offset for the data record is found, a single seek is all that is required to retrieve the record.
No buffer management is applied to the index.
Buffer management could reduce the number of disk I/Os.
Manipulating an index on a disk is slow and complicated.
However, except the obvious advantage of easy maintenance, it has some other advantages over the use of a data file sorted by key:
A simple index makes it possible to use a binary search to obtain keyed access to a record in a variable-length record file.
The index provides the service of associating a fixed-length and therefore binary-searchable record with each variable-length data record.
A record is pinned when there are other records/file structures that refer to it by its physical location.
If there are pinned records in the data file, an index lets us rearrange the keys without moving the data records.