Free Space management
Disk Space ManagementEdit
Q Write short note on : Disk management. - --- ( 4 M May 2016 )
Ans : Operating system maintains a list of free disk blocks. Free disk blocks are those blocks in a disk which are not being used by any file whenever a file is created, the list of free disk blocks is searched for and then allocated to new block. The blocks allocated to this file are then removed from the list of free blocks. When a file is deleted, its disk space is added to the list of free blocks methods of disk management
a) Linked List :- In this method all free disk blocks are linked together by each free block pointing to the next free block. Figure shows block 3 is first free block of linked list of free block. Block 3 contains address of the next free block 6, which contains address of block 10 and so on. The last free block is 21, which is not pointing to any free block. This scheme requires additional memory for maintaining linked of all free disk block. This space could be quite large when the disk is almost empty. But if disk is nearly full very few block are free then linked list could be the desired method.
b) Bit Map Method :- In this method , the list of free disk block is implemented as a bit map. Each block is represented by a single bit :
- 0 for a free block
- 1 for allocated block
For example as per figure (a) block 3 , 6 , 10, 14 and 21 are free so in bit map they are represented as
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - bit no.
1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 - bit map
Advantages It is very simple method. Compared to linked list it requires less space.
Disadvantages If the disk is nearly full then finding a free block may require many comparisons.
- WikiNote Foundation