Key:
a subset of the fields in a record used to identify (uniquely) the recordTypical Operations:
Retrieve a record - Insert
a record - Delete
a record – Modify
a field of a recordIn direct files:
Get a record with a given field valueIn sequential
files: Get the next recordstored contiguously
on the storage device.beginning to end
Unordered sequential
files are called (pile files).Sorted sequential
files (records are ordered by some field)succession of records
, simply placed one after another with no additional structure
Records may vary in length.best organization
for operations.Exhaustive Reading of the File
is Read and process all records (reading order is not important).no basic operation
that allows us to “remove part of a file”.taken care
of by the program responsible for file organization.must include logic that checks if record is deleted or not
Storage Compaction.
AVAIL LIST
, a linked list of available recordstake care of the variable-length difficulties
store its size as a field.
Exact byte offset must be used.
must find a large enough record
in AVAIL LIST
First-fit Strategy:
AVAIL LIST is not sorted by size; first record large enough is used for the new record.Best-fit Strategy:
List is sorted by size. Smallest record large enough is usedWorst-fit strategy:
List is sorted by decreasing order of size; largest record is used; unused space is placed in AVAIL LIST 21 again.b
is the total number of blocks
in the file.beginning
of the file, then at least 1 block
is accessedend
of the file, then at most b
blocks are accessedfind and read a record
in a pile file is => Time to fetch
one record = (b/2) * effective block transfer timeexhaustive
reading of the file = seek time + rotational delay time + b * time to transfer one blockread the last block
= seek time + rotational delay time + block transfer timeinsert a new record
= Time to read the last block + 2rNote
(2r - block transfer time):the time to wait for the disk
until itrotates back to the original position
Note
(Block transfer time): the time totransfer the new record
update
a record for fixed length
records = Time to fetch the record + 2rupdate
a record for variable length
records = Time to delete the record + time to insert the new one