aims:
1.Effective use of disk space
2.Quick access to files
There are three common types of distribution methods:
1.Continuous allocation
2.Link assignment
3.Index allocation
Contiguous allocation
The continuous allocation method requires each file to occupy a contiguous block of disks.
advantage:
- Simple - just record the starting position (block number) and length of the file.
- Accessing files is easy and requires minimal seek time
Sequential access
direct interview.
Disadvantages:
- It is difficult to find space for new documents
- For the first time, the best, the worst
- The file is difficult to grow
Linked allocation
Link assignments solve all the problems of continuous allocation.
With link assignment, each file is a linked list of disk blocks:
- Disk blocks are distributed anywhere on the disk.
- Each directory entry has a pointer to the first block of the file.
- The pointer is initialized to nil (the value of the footer pointer) to identify an empty file.
advantage:
- Simple - just the starting position
- File creation and growth is easy
Disadvantages:
- Can not be randomly accessed
- The link pointer between the block and the block takes up space
- There are reliability issues
Indexed allocation
Features:
- Put all the data block pointers into the index block
The ith entry in the index block points to the ith block of the file.
- The directory entry includes the address of the index block
- Each file has an index block;
- Array of disk block addresses
- Index allocation supports direct access, and there is no external fragmentation problem
- The index block itself may waste space
Link scheme: An index block is usually a disk block.For large files, multiple index blocks can be linked together.
Multi-layer index: Indirect addressing similar to memory (primary, secondary, indirect...)