Figure 10.4 File containing instructor records.
To avoid the first problem, we allocate only as many records to a block as
would fit entirely in the block (this number can be computed easily by dividing the
block size by the record size, and discarding the fractional part). Any remaining
bytes of each block are left unused.
When a record is deleted,we could move the record that came after it into the
space formerly occupied by the deleted record, and so on, until every record following
the deleted record has been moved ahead (Figure 10.5). Such an approach
requires moving a large number of records. It might be easier simply to move the
final record of the file into the space occupied by the deleted record (Figure 10.6).
It is undesirable tomove records to occupy the space freed by a deleted record,
since doing so requires additional block accesses. Since insertions tend to be more
frequent than deletions, it is acceptable to leave open the space occupied by the