Lab 6
Lab 6
Files
LAB 6
Lab Agenda
▪ Avail List
▪ Deletion and Addition of Fixed-Length Records
▪ Deletion and Addition Variable-Length Records (Project)
▪ Dynamic Replacement Strategies
▪ First-Fit
▪ Best-Fit
▪ Worst-Fit
Avail List
▪ A linked list of available records.
▪ Used to easily track the space of deleted records for storing new
records added later.
▪ Has a header record that stores the last deleted record.
Avail List Example
▪ Assume we have a file with 10 records and the following records
has been deleted in the same order: Rec.2, Rec.5, and Rec.3
NO records deleted: -1
Avail List Example
▪ Assume we have a file with 10 records and the following records
has been deleted in the same order: Rec.2, Rec.5, and Rec.3
3 *5 *2 *-1
Avail List : Fixed-Length Record Example
▪ Assume we have a file with 10 records and the following records
has been deleted in the same order: Rec.2 and Rec.5
NO records deleted : -1
Best-Fit
Worst-Fit
Where will a 25 byte record be added?
First-Fit
Best-Fit
Worst-Fit
Where will a 15 byte record be added?
First-Fit
Best-Fit
Worst-Fit
First-Fit with Variable Length Record
▪ Assume we have a file and the following operations has been
performed in the same order:
Record 2 was deleted: 10 *-1|20
▪ Can you read the sentence in this file whose characters are written in random order?
▪ Note: the next record of the last character in the sentence will be “-1”