Presentation is loading. Please wait.

Presentation is loading. Please wait.

26 - File Systems.

Similar presentations


Presentation on theme: "26 - File Systems."— Presentation transcript:

1 26 - File Systems

2 Secondary storage management
Disk space management Free space management Disk is divided into blocks or sectors.

3 Disk space management When to allocate space? Portion size
Pre-allocation vs. dynamic allocation. Portion size Large variable-sized portions consisting of contiguous blocks Placement algorithms – Best fit, First fit and Next fit Small fixed portions (non-contiguous blocks)

4 Disk space management File allocation methods
Keep track of which sectors/blocks on the disk belong to which logical file/directory.

5 Contiguous File Allocation
What happens if file F requires 6 blocks?

6 Contiguous allocation

7 File allocation methods - contiguous
Contiguous set of blocks is allocated to a file. File allocation table entry is simple Start of the file and size of the file. Entire file/directory can be read from the disk in one operation. Good for sequential access. External fragmentation occurs Frequent compaction required. Pre-allocation is required. Maximum file size should be known.

8 File allocation method - Chained allocation/Linked list

9 Chained allocation/Linked list

10 Chained allocation after consolidation

11 Chained allocation/Linked list allocation
No external fragmentation File allocation table entry is simple Pointer to first block (and # of blocks) Inefficient with random access files. Consolidation is performed. Pre-allocation is possible, but more common to dynamically allocate.

12 Linked list allocation with an index
File A occupies a total of _______ blocks and they are ________________. File B occupies a total of _____ blocks and they are __________________.

13 Linked list allocation with index
A table is maintained in memory which acts as the linked list. Don’t have to access the disk to get the next pointer More efficient with random access files. Used in MS-DOS

14 Indexed allocation

15 Indexed file allocation
No external fragmentation. Random access of file is efficient. File allocation table entry is simple Pointer to index-node (i-node) Used in UNIX. Can optimize disk reads as all data blocks are known.

16 Free space management Disk allocation table
to keep track of all the used and unused blocks on the disk.

17 Free space management Disk allocation table
to keep track of all the used and unused blocks on the disk. Bit maps/tables Chained free portions Free block list

18 Free space management

19 Bit maps/tables a bit for every block 1 => in-use
0 => available. Relatively small amount of storage required. Easy to find contiguous set of free blocks. The number of blocks required to hold the bit map is fixed. Held in memory

20 Chained free portions Each free portion has a pointer to the next free portion. No disk allocation table required. Must read a free block before you can write to it. To determine the next free block (for updating).

21 Free block list Every block is assigned an id in sequential order.
In a reserved part of the disk, a list of the ids of free blocks is maintained. Some part of the list can be placed in memory for quick access. The id size depends on the number of blocks on disk. The number of blocks required to hold the ids depends on how many blocks are free.

22 Indexing Treat free space like a large file
Maintain an index of all the free blocks. Use variable-size portions for allocation and this will reduce the size of the index table.


Download ppt "26 - File Systems."

Similar presentations


Ads by Google