one seek file system
DESCRIPTION
One Seek File System. Sharath R. Cholleti [email protected]. Center for Distributed Object Computing Department of Computer Science and Engineering Washington University. Fall 03 E71 CS 6785 Programming Languages Seminar 07 Nov 2003. Outline. Fixed size blocks file system - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/1.jpg)
One Seek File System
Sharath R. Cholleti
Center for Distributed Object ComputingDepartment of Computer Science and Engineering
Washington University
Fall 03 E71 CS 6785 Programming Languages Seminar
07 Nov 2003
![Page 2: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/2.jpg)
Sharath R. Cholleti
Outline
• Fixed size blocks file system• Extent based file system• Buddy system• Buddy file system• Sum of powers of 2 blocks• Experiments• Heap manager algorithm• Defragmentation• Bounds
![Page 3: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/3.jpg)
Sharath R. Cholleti
Fixed size blocks
• Blocks could be non-contiguous• Could be spread all over the disk• Number of seeks proportional to file size
– O(S)
![Page 4: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/4.jpg)
Sharath R. Cholleti
Extent based File System
• Limited number of extents per file• An extent can be of arbitrarily large• Number of seeks is limited
– O(1)
• Problems– Difficult to predict the size of the extents
• Cross the limit of number of extents per file– Variable size gives rise to fragmentation
• DTSS – shown to be practical without too much internal or external fragmentation
![Page 5: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/5.jpg)
Sharath R. Cholleti
Knuth’s Buddy System
• Free lists segregated by size
128
64
32
16
8
4
2
1
• All the requests are rounded up to a power of 2
![Page 6: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/6.jpg)
Sharath R. Cholleti
Buddy System (1)
• Begin with one large block
• Suppose we want a block of size 8
128
64
32
16
8
4
2
1
![Page 7: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/7.jpg)
Sharath R. Cholleti
Buddy System (2)
• Begin with one large block
• Suppose we want a block of size 8
• Subdivide recursively
128
64
32
16
8
4
2
1
![Page 8: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/8.jpg)
Sharath R. Cholleti
Buddy System (3)
• Begin with one large block
• Suppose we want a block of size 8
• Subdivide recursively
128
64
32
16
8
4
2
1
![Page 9: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/9.jpg)
Sharath R. Cholleti
Buddy System (4)
• Begin with one large block
• Suppose we want a block of size 8
• Subdivide recursively
128
64
32
16
8
4
2
1
![Page 10: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/10.jpg)
Sharath R. Cholleti
Buddy System (5)
• Begin with one large block
• Suppose we want a block of size 8
• Subdivide recursively
• 2 blocks of size 8
128
64
32
16
8
4
2
1
![Page 11: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/11.jpg)
Sharath R. Cholleti
Buddy System (6)
• Begin with one large block
• Suppose we want a block of size 8
• Subdivide recursively• 2 blocks of size 8• One of those given to
the program
128
64
32
16
8
4
2
1
Given to the program
![Page 12: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/12.jpg)
Sharath R. Cholleti
Buddy System (7)
• Coalescing• Only buddies coalesce 128
64
32
16
8
4
2
1
Deallocated
![Page 13: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/13.jpg)
Sharath R. Cholleti
Buddy File System
• Round the file size to a power of 2• Only one large block
– Mostly only 1 seek
• Fast allocation• Deallocation – coalescing with its buddy• High internal fragmentation
– Worse case almost 50%– Average 25%
![Page 14: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/14.jpg)
Sharath R. Cholleti
Buddy System: Tree Notation
16
8
4
2
1
Allocate block of size 1
Free
Occupied
![Page 15: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/15.jpg)
Sharath R. Cholleti
Buddy System: Tree Notation(2)
16
8
4
2
1
Allocate block of size 1
Free
Occupied
![Page 16: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/16.jpg)
Sharath R. Cholleti
Buddy System: Tree Notation(3)
16
8
4
2
1
Allocate block of size 1
Free
Occupied
![Page 17: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/17.jpg)
Sharath R. Cholleti
Buddy System: Tree Notation(4)
16
8
4
2
1
Allocate block of size 1
Free
Occupied
![Page 18: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/18.jpg)
Sharath R. Cholleti
Buddy System: Tree Notation(6)
16
8
4
2
1
Allocate block of size 4
Free
Occupied
![Page 19: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/19.jpg)
Sharath R. Cholleti
Sum of powers of 2 blocks
• Buddy blocks of different sizes• 13 = 8 + 4 + 1
1
2
4
8
16
32
Free
Occupied
![Page 20: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/20.jpg)
Sharath R. Cholleti
Allocation as Sum of powers of 2 blocks
• Internal fragmentation same as file system with blocks of equal size
• Buddy type coalescing helps control the external fragmentation
• Number of seeks is O(log S)• What if allocate the blocks contiguously?• Or make it contiguous after allocation• Only one seek necessary
![Page 21: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/21.jpg)
Sharath R. Cholleti
Experiments
• CEC data• user file sizes• Usual (blocks of same size) vs Buddy vs Sum of
powers of 2– Total blocks (segments)– Wasted space– Min/avg/max number of segments
![Page 25: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/25.jpg)
Sharath R. Cholleti
Results
• Sum of powers of 2– Much lesser internal fragmentation compared to
buddy– Very few blocks compared to fixed block size file
system
• Experiments to limit the number of segments to a constant
![Page 26: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/26.jpg)
Sharath R. Cholleti
Heap Manager Algorithm
1 02
1 4
5
2 1
3
0 0
0
3
8
1
2
4
8
16
![Page 27: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/27.jpg)
Sharath R. Cholleti
Defragmentation
• Need to allocate a block of size 8 • No free block of size 8 -- relocate
1
2
4
8
16
32
Free
Occupied
![Page 28: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/28.jpg)
Sharath R. Cholleti
Defragmentation (2)
• Need to allocate a block of size 8• No free block of size 8 -- relocate
1
2
4
8
16
32
Free
Occupied
![Page 29: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/29.jpg)
Sharath R. Cholleti
Cost
• M – disk size• Allocation O(logM)• Deallocation O(logM)• Relocation O(slogM) – file of size s
![Page 30: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/30.jpg)
Sharath R. Cholleti
Defragmentation Theory Assumptions
• All files are stored contiguously• Each file is stored big to small• File of size S, 2^n<S<=2^(n+1), lies entirely
within a buddy block of 2^(n+1)• Unit of the file is a block• There is a way to allocate or relocate a file
![Page 31: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/31.jpg)
Sharath R. Cholleti
Bound on relocated file size
• For the relocation to be minimum, allocation of a file of size 2^n does not relocate file of size greater than 2^(n-1)
• Proof:– X: a file or a set of files– R(X): number of blocks moved to relocate X
![Page 32: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/32.jpg)
Sharath R. Cholleti
Proof (cont)
a EDB
R = R(a) + R(B)
= |a| + R(D) + R(B)
> |E| + R(D) + R(B)
![Page 34: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/34.jpg)
Sharath R. Cholleti
Worst case relocation file size
• In worst case, to allocate a file of size 2^n, two files of size 2^(n-1) are relocated
![Page 35: One Seek File System](https://reader031.vdocuments.site/reader031/viewer/2022032709/56813065550346895d963d5a/html5/thumbnails/35.jpg)
Sharath R. Cholleti
Worst Case Defragmentation
• Worst-case relocation for a file of size S– SlogS blocks
• R(S) = S + 2*R(S/2)– 2(S-1) files
• R(S) = 1 + 2*R(S/2)