0% found this document useful (0 votes)
36 views

File Allocation Methods

File allocation methods ss and os

Uploaded by

Simal Jaan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

File Allocation Methods

File allocation methods ss and os

Uploaded by

Simal Jaan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

FILE ALLOCATION METHODS

IN OPERATING SYSTEM
There are various methods which can be used to allocate disk space to
the files. Selection of an appropriate allocation method will significantly
affect the performance and efficiency of the system. Allocation method
provides a way in which the disk will be utilized and the files will be
accessed.
1. Contiguous Allocation
• Each file occupies a contiguous address space on the disk.
• Assigned disk address is in linear order.
• Easy to implement. External fragmentation is a major issue with this
type of allocation technique.
Advantages
1.It is simple to implement.
2.We will get Excellent read performance.
3.Supports Random Access into files.

Disadvantages
1.The disk will become fragmented.
2.Difficulty in Dynamic Allocation: It may be difficult to have a file grow.
2. Linked List Allocation
• Linked List allocation solves all problems of contiguous allocation. In
linked list allocation, each file is considered as the linked list of disk
blocks. However, the disks blocks allocated to a particular file need not
to be contiguous on the disk. Each disk block allocated to a file contains
a pointer which points to the next disk block allocated to the same file.
Advantages
1.There is no external fragmentation with linked allocation.
2.Any free block can be utilized in order to satisfy the file block requests.
3.File can continue to grow as long as the free blocks are available.
4.Directory entry will only contain the starting block address.

Disadvantages
1.Random Access is not provided.
2.Pointers require some space in the disk blocks.
3.Any of the pointers in the linked list must not be broken
otherwise the file will get corrupted.
4.Need to traverse each block.
File Allocation Table
The main disadvantage of linked list allocation is that Random access to a particular
block is not provided. In order to access a block, we need to access all its previous
blocks.

File Allocation Table overcomes this drawback of linked list allocation. In this
scheme, a file allocation table is maintained, which gathers all the disk block links.
The table has one entry for each disk block and is indexed by block number.
The file allocation table 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.

It simply accesses the file allocation table, reads the desired block entry from there
and accesses that block. This is the way which the random access is accomplished
by using FAT. It is used by MS-DOS and pre-NT Windows versions.
Advantages
1.Uses the whole disk block for data.
2.A bad disk block doesn't cause all successive blocks lost.
3.Random access is provided although its not too fast.
4.Only FAT needs to be traversed in each file operation.

Disadvantages
1.Each Disk block needs a FAT entry.
2.FAT size may be very big depending upon the number of FAT entries.
3.Number of FAT entries can be reduced by increasing the block size but
it will also increase Internal Fragmentation.
Indexed Allocation
Limitation of FAT
limitation in the existing technology causes the evolution of a new technology. Till
now, we have seen various allocation methods; each of them was carrying several
advantages and disadvantages.
File allocation table tries to solve as many problems as possible but leads to a
drawback. The more the number of blocks, the more will be the size of FAT.
Therefore, we need to allocate more space to a file allocation table. Since, file
allocation table needs to be cached therefore it is impossible to have as many space in
cache. Here we need a new technology which can solve such problems.

Indexed Allocation Scheme


Instead of maintaining a file allocation table of all the disk pointers, Indexed allocation
scheme stores all the disk pointers in one of the blocks called as indexed block.
Indexed block doesn't hold the file data, but it holds the pointers to all the disk blocks
allocated to that particular file. Directory entry will only contain the index block
address.
Advantages
1.Supports direct access
2.A bad data block causes the lost of only that block.

Disadvantages
1.A bad index block could cause the lost of entire file.
2.Size of a file depends upon the number of pointers, a index block can
hold.
3.Having an index block for a small file is totally wastage.
4.More pointer overhead
• Multilevel Index Allocation
• In Multilevel index allocation, we have various levels of indices. There
are outer-level index blocks that contain the pointers to the inner-
level index blocks and the inner-level index blocks contain the
pointers to the file data.
• The outer level index is used to find the inner level index.
• The inner level index is used to find the desired data block.
• Advantage: Random Access becomes better and more efficient.
• Disadvantage: Access time for a file will be higher.

You might also like