FILE ALLOCATION METHODS
Overview
Introduction
Allocation methods
Types of Allocation methods
Contiguous Allocation
Linked list Allocation
Indexed Allocation
Introduction
File system is the most visible part of the
operating system. Files are stored in disks. Whenever files are
created or appended, space for the files has to be allocated in
disks. For this, the operating system should keep track of which
disk blocks are free and which blocks are allocated.
ALLOCATION METHODS
An allocation method refers to how disk blocks
are allocated for a file. The size of disk blocks is
fixed. Whenever a new file is created or size of file
increases because of writing to the file, disk blocks
are allocated for the file.
Disk space should be allocated to files such
that the :
Disk space is utilized effectively
Files can be accessed quickly
TYPES OF ALLOCATION
METHODS
There are three different methods of allocation:
Contiguous Allocation
Linked List Allocation
Indexed Allocation
CONTIGUOUS ALLOCATION
Blocks are allocated to the file in such a way that all
the logical blocks of the file get the contiguous physical
block in the hard disk .
It is enough to remember only starting location and
length of the file.
Advantages:
It is simple to implement.
Supports Random Access into files.
Disadvantages:
Fragmentation
Difficult to have a file grow
LINKED LIST ALLOCATION
In linked list allocation, each file is considered as the linked list of disk blocks.
Each disk block allocated to the file need not be contiguous and contains a pointer
which points to the next block allocated to the same file.
LINKED LIST
ALLOCATION
ADVANTAGES:
No external fragmentation
Any free block can be utilized
Directory entry will only contain
starting block address
File can continue to grow as long
as the free blocks are available
DISADVANTAGES:
Random Access not provided
Pointers requires space
Reliability
FILE ALLOCATION TABLE
FAT gathers all the disk block links. It has
one entry for each disk block and is
indexed by block number.
It needs to be cached in order to reduce
the number of head seeks.
Now the head doesn’t need to traverse all
the disk blocks in order to access one
successive block
Disadvantage:
Each disk block needs a FAT entry
FAT size may be big depending
upon the no. of entries.
INDEXED
ALLOCATION
METHOD
It stores all the disk pointers in of the
blocks .Indexed block doesn’t hold data,
but it holds the pointers to all the disk
blocks allocated to that particular file.
Directory entry will only contain index
block address.
04
INDEXED ALLOCATION METHOD
Advantages Disadvantages
More pointer
Supports direct access overhead
A bad data block causes the A bad index block
lost of only that block could cause the lost
of entire file
Index block for
small file is total
wastage
THANK YOU!