Professional Documents
Culture Documents
Allocation Methods
Allocation Methods
n Contiguous allocation
n Linked allocation
n Indexed allocation
12.1
Contiguous Allocation
n Random access.
n Wasteful of space (dynamic storage-allocation problem).
n Files cannot grow.
12.2
1
1
12.3
Extent-Based Systems
n Many newer file systems (I.e. Veritas File System) use a
modified contiguous allocation scheme.
12.4
2
2
Linked Allocation
n Each file is a linked list of disk blocks: blocks may be
scattered anywhere on the disk.
block
pointer
12.5
12.6
3
3
Linked Allocation
12.7
File-Allocation Table
12.8
4
4
Indexed Allocation
n Brings all pointers together into the index block.
n Logical view.
index table
12.9
12.10
5
5
12.11
Q2
R 1 / 512
R2
12.12
6
6
Q2
R 1 / 512
R2
12.13
outer-index
index table
12.14
file
7
7
12.15
Free-Space Management
n Bit vector
(n b l o c k s )
0
n-1
bit[i ] =
678
0
1
block[i ] free
block[i ]
occupied
12.16
8
8
30
30
/2 12 = 2
bytes (1 gigabyte)
18
n Grouping
n Counting
12.17
n Need to protect:
F Pointer to free list
F Bit map
4Must be kept on disk
4 Copy in memory and disk may differ.
4 C a n n o t a l l o w f o r b l o c k [i ] t o h a v e a s i t u a t i o n w h e r e b i t [ i ] =
1 i n m e m o r y a n d b i t [ i] = 0 o n d i s k .
F Solution:
4 Set bit[i] = 1 in disk.
4 A l l o c a t e b l o c k [i ]
4 Set bit[i] = 1 i n m e m o r y
12.18
9
9
12.19
n Performance
F disk cache separate section of main memory for
frequently used blocks
12.20
10
10