2. Secondary Storage Management
“Portion”: a group of contiguous blocks
File Allocation Table (FAT)
Keeps track of portions assigned to a file
Must also keep track of the space available for new
allocations
2
3. Secondary Storage Management
“Preallocation”
Requires maximum size for the file to be known at the
time of file creation
Facilitates allocation of entire file as one portion on the
same cylinder
Difficult to reliably estimate the maximum potential size
of the file
File size is usually overestimated so as to not run out of
space
“Dynamic allocation”
Allocates new portions to a file as needed
3
4. File allocation methods
Contiguous allocation
One portion is used
For each file, the FAT contains the starting block and
the number of blocks
Requires preallocation
Gives great performance for sequential access
For “random” access, it is easy to calculate the disk
location
External fragmentation will occur
Need to perform compaction
Note the memory analogy with dynamic partitioning
4
7. File allocation methods
Chained allocation
Allocation on basis of individual blocks
Each block contains a pointer to the next block in the
chain
FAT is same as for contiguous allocation
Starting block and number of blocks
No external fragmentation
Only sequential access is possible with poor
performance
No accommodation of the principle of locality
7
9. “Consolidation” makes
sequential access
more efficient
and accommodates
the principle of locality
9
10. File allocation methods
Indexed allocation
For each file, the FAT contains a separate one-level
index table
The index table has one entry for each portion allocated
to the file
Entry consists of the starting block and number of
blocks
The index table is usually on disk
10
11. File allocation methods
Indexed allocation
Allocation can be by . . .
single blocks
• 1-block portions
• no fragmentation
variable-sized portions
• better performance
Popular method for both sequential and indexed access
11
14. Free space management
A disk allocation table records which blocks are
available
Implementation techniques are as follows . . .
Bit table
One bit per block
Compact representation – can be kept in RAM
Easy to find contiguous blocks
14
15. Free space management
Chained free portions
File of chained portions
Only need the location and size of the first portion
Indexing
One entry for each free portion
Treats free space as a file of variable-sized portions
15