Free Space Management, Efficiency & Performance, Recovery and NFS

14
Free Space Management, Efficiency & Performance, Recovery and NFS Department of Computer Science & Engineering Hamdard University Bangladesh

Transcript of Free Space Management, Efficiency & Performance, Recovery and NFS

Page 1: Free Space Management, Efficiency & Performance, Recovery and NFS

Free Space Management, Efficiency & Performance, Recovery and NFS

Department of Computer Science & Engineering

Hamdard University Bangladesh

Page 2: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 3: Free Space Management, Efficiency & Performance, Recovery and NFS

Various Implementations of Free Space List

Bit Vector

Linked List

Grouping

Counting

Page 4: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 5: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 6: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 7: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 8: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 9: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 10: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 11: Free Space Management, Efficiency & Performance, Recovery and NFS

Counting

• Entry in a free space list consists of

– Disk address

– Count

Page 12: Free Space Management, Efficiency & Performance, Recovery and NFS

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.

Page 13: Free Space Management, Efficiency & Performance, Recovery and NFS

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

Page 14: Free Space Management, Efficiency & Performance, Recovery and NFS

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)