Module5FileSystemsImplementation-PPT
Module5FileSystemsImplementation-PPT
File System
Implementation
File System Implementation
File-System Structure
File-System Implementation
Directory Implementation
Allocation Methods
Free-Space Management
Basic file system issues commands like “retrieve block 123” to device
driver Also manages memory buffers and caches
Buffers hold data in transit
Caches hold frequently used data
Application Programs
Written By Users
Layering useful for reducing complexity and redundancy, but adds
overhead and can decrease performance
Logical layers can be implemented by any coding method according to OS designer
1. Contiguous Allocation
2. Linked Allocation
3. Indexed Allocation
3. Indexed Allocation
If the index block is already in memory, then the access can be made directly
Keeping the index block in memory requires considerable space
Good for direct access
DR.BHAGYA JYOTHI K L,KVGCE
Free-Space Management
Managing the free blocks of hard disk in known as Free space management.
A free-space list is maintained to keep track of free disk-space (i.e. those not allocated
to some file or directory).
It contains the information about free blocks in the hard disk
During File creation
1. OS searches the free-space list for the required amount of space.
2. Allocate that space to the new file.
3. This space is then removed from the free-space list.
During file Deletion
Deleted file disk-space is added to the free-space list.
For example, consider a disk where blocks 2, 3, 4, 5 and 7 are free and the rest
of the blocks are allocated. The free-space bit map will be 00111101
Disadvantages:
1. Inefficient unless the entire vector is kept in main memory.
2. The entire vector is written to discDR.BHAGYA
occasionally
JYOTHI Kfor recovery.
L,KVGCE
2. Linked List
1. Link all the free disk-blocks together as a List
2. Keep a pointer to the first free block in a special location on
the disk.
3. Cache that block in memory.
• The first block contains a pointer to the next free one, etc.
Advantage:
• Efficient
Disadvantage:
1. Not efficient, because to traverse the list, each block is read.
Keep the address of the first free block and the number ‘n’ of free
contiguous blocks that follow the first block.
Takes advantage of the fact that, generally, several contiguous
blocks may be allocated/freed simultaneously.
Each entry in the free-space list then consists of a disk address and a
count.