Lesson 7 INF211 Lect 08
Lesson 7 INF211 Lect 08
Previous
Previous Lecture
Lecture
Lecture 7
Data Compression
Today
Today Lecture
Lecture
Overview
In this lecture, we continue to
Outline
Part 1
Motivation
Let us consider a file of records (fixed length
or variable length).
We know how to create a file, add records to
a file and modify the content of a record.
These actions can be performed physically by using
Compaction
Records
Use an AVAIL LIST as before but take
care of the variable-length
difficulties.
The records in AVAIL LIST must store
its size as a field.
RRN can not be used, but exact byte
offset must be used.
AVAIL LIST
External Fragmentation
Ways of combating external fragmentation
Coalescing the holes: if two records in
AVAIL LIST are adjacent, combine them
into a larger record.
Minimize fragmentation by using one of
the previously mentioned placement
strategies
for example: worst-fit strategy is better than
Part 2
Binary Searching
Let us consider fixed-length records that must
A
Al Bin
go ar
rit y S
hm ea
in rch
C+
+
Keysorting
Suppose a file needs to be sorted, but
corresponding RRN
Do internal sorting of keys
Rewrite the file in sorted order
Example
Indexing
How much effort we must do (in
(seek)
Write each record once (sequentially)
instead
Pinned Records
Remember that in order to support
Next
Next Lecture
Lecture
Indexing
Questions?