Free Space Management, Efficiency & Performance, Recovery and NFS
1. Free Space Management, Efficiency &
Performance, Recovery and NFS
Department of Computer Science & Engineering
Hamdard University Bangladesh
2. Free Space Management
To keep track of disk space :
o The system maintains a free space list
o The free space list records all disk blocks that are free
4. Bit Vector
• Free space list is implemented as a bit map or bit vector
• If the block is free the bit is set to 1
• If the block is allocated the bit is set to 0
5. Bit vector (n blocks)
…
0 1 2 n-1
bit[i] =
0 block[i] free
1 block[i] occupied
Block number calculation
(number of bits per word) *
(number of 0-value words) +
offset of first 1 bit
Bit Vector
6. Bit map requires extra space. Example:
block size = 212 bytes (4 K)
disk size = 230 bytes (1 gigabyte)
n = 230/212 = 218 bits (or 32K bytes)
Easy to get contiguous files
Linked list (free list)
Cannot get contiguous space easily
No waste of space
Grouping
Large free blocks can be quickly found
Counting
Bit Vector
7. Linked List
Link all free disk blocks together
Keep a pointer to the first free block
This block contains a pointer to next free block, and so on
8. Linked Free Space List on Disk
Example:
Pointer to block 2, as the first free block
Block 2 would contain a pointer to block 3,
Which would point to block 4,
Which would point 5,8,9,10,11,12,13,17,18,25,26,27
9. Grouping
Store addresses of n free blocks in the first free block
The first n-1 of these are actually free
The last block contains the address as of another free blocks.
Block No
.
Block No
.
.
Block No
Block No
.
Block No
Block No
Block No
.
.
.
Block No
Block No
. . .
First Free
block
10. Counting
Based on the fact that several contiguous blocks may be allocated and freed
simultaneously
Holds the address of the first free block and number “n” of free contiguous blocks
that follow the first block
Each entry is the free space list consist of a disk address and a count
12. Efficiency and Performance
Efficiency dependent on:
disk allocation and directory algorithms
types of data kept in file’s directory entry
Performance
disk cache – separate section of main memory for frequently
used blocks
free-behind and read-ahead – techniques to optimize
sequential access
improve PC performance by dedicating section of memory
as virtual disk, or RAM disk.
13. Recovery Techniques
• Consistency checking – compares data in directory structure with
data blocks on disk, and tries to fix inconsistencies
• Use system programs to back up data from disk to another storage
device (floppy disk, magnetic tape, other magnetic disk, optical)
• Recover lost file or disk by restoring data from backup
14. An implementation and a specification of a software system for accessing
remote files across LANs (or WANs).
The implementation is part of the Solaris and SunOS operating systems
running on Sun workstations using an unreliable datagram protocol
(UDP/IP protocol and Ethernet.
Network File System (NFS)