Review Magnetic Disk Characteristic Cylinder all the tracks under the head at a given point on all surface Head Read write data is a three stage process CS162 Operating Systems and Systems Programming Lecture 18 Track Sector Cylinder Platter Seek time position the head arm over the proper track into proper cylinder Rotational latency wait for the desired sector to rotate under the read write head Transfer time transfer a block of bits sector under the read write head File Systems Naming and Directories Disk Latency Queueing Time Controller time Seek Time Rotation Time Xfer Time Media Time Seek Rot Xfer Result Software Queue Device Driver Hardware Controller Request April 7 2008 Prof Anthony D Joseph http inst eecs berkeley edu cs162 Highest Bandwidth transfer large group of blocks sequentially from one track 4 7 08 Review Multilevel Indexed Files UNIX 4 1 Multilevel Indexed Files Like multilevel address translation from UNIX 4 1 BSD Joseph CS162 UCB Spring 2008 Lec 18 2 Review Example of Multilevel Indexed Files Sample file in multilevel indexed format How many accesses for block 23 assume file header accessed on open Key idea efficient for small files but still allow big files Two One for indirect block one for data How about block 5 One One for data Block 340 File hdr contains 13 pointers Three double indirect block indirect block and data Fixed size table pointers not all equivalent This header is called an inode in UNIX UNIX 4 1 Pros and cons File Header format Pros Simple more or less Files can easily expand up to a point Small files particularly cheap and easy Cons Lots of seeks Very large files must read many indirect blocks four I Os per block First 10 pointers are to data blocks Ptr 11 points to indirect block containing 256 block ptrs Pointer 12 points to doubly indirect block containing 256 indirect block ptrs for total of 64K blocks Pointer 13 points to a triply indirect block 16M blocks 4 7 08 Joseph CS162 UCB Spring 2008 4 7 08 Lec 18 3 Page 1 Joseph CS162 UCB Spring 2008 Lec 18 4 Goals for Today Review Multilevel Indexed Files UNIX 4 1 Basic technique places an upper limit on file size that is approximately 16Gbytes File Systems Structure Naming Directories Designers thought this was bigger than anything anyone would need Much bigger than a disk at the time Fallacy today EOS producing 2TB of data per day Caching in File Systems Pointers get filled in dynamically need to allocate indirect block only when file grows 10 blocks On small files no indirection needed Note Some slides and or pictures in the following are adapted from slides 2005 Silberschatz Galvin and Gagne Gagne Many slides generated from my lecture notes by Kubiatowicz 4 7 08 Joseph CS162 UCB Spring 2008 4 7 08 Lec 18 5 File Allocation for Cray 1 DEMOS basesize file header base size file header indirect block group disk group 1 3 2 1 3 3 1 3 4 1 3 5 1 3 6 1 3 7 1 3 8 1 3 9 If need more than 10 groups set flag in header BIGFILE using contiguous allocation in normal case but allow flexibility to have non contiguous allocation Each table entry now points to an indirect block group Suppose 1000 blocks in a block group 80GB max file Assuming 8KB blocks 8byte entries 10 ptrs 1024 groups ptr 1000 blocks group 8K 80GB Cray 1 had 12ns cycle time so CPU disk speed ratio about the same as today a few million instructions per seek Discussion of DEMOS scheme Header table of base size 10 block group pointers Pros Fast sequential access Free areas merge simply Easy to find free block groups when disk not full Cons Disk full No long runs of blocks fragmentation so high overhead allocation access Full disk worst of 4 1BSD lots of seeks with worst of continuous allocation lots of recompaction needed Each block chunk is a contiguous group of disk blocks Sequential reads within a block chunk can proceed at high speed similar to continuous allocation How do you find an available block group Joseph CS162 UCB Spring 2008 base size What if need much bigger files Idea reduce disk seeks by Use freelist bitmap to find block of 0 s Lec 18 6 Large File Version of DEMOS disk group 1 3 2 1 3 3 1 3 4 Basic Segmentation Structure 1 3 5 Each segment contiguous on disk 1 3 6 1 3 7 1 3 8 1 3 9 DEMOS File system structure similar to segmentation 4 7 08 Joseph CS162 UCB Spring 2008 4 7 08 Lec 18 7 Page 2 Joseph CS162 UCB Spring 2008 Lec 18 8 How to keep DEMOS performing well In many systems disks are always full Administrivia CS department growth 300 GB to 1TB in a year Plan Ahead this month will be difficult How to fix Announce that disk space is getting low so please delete files Project 3 design doc due today at 11 59pm Project deadlines every week That s 2GB day Now at 65 50 TB Don t really work people try to store their data faster Sidebar Perhaps we are getting out of this mode with new disks However let s assume disks full for now Midterm 2 is next Wednesday April 16th 6 7 30pm in 10 Evans All material from projects 1 3 lectures 9 2 25 to 19 4 9 Solution Don t let disks get completely full reserve portion OS History Services and Structure CPU Scheduling Kernel and Address Spaces Address Translation Caching and TLBs Demand Paging I O Systems Filesystems Disk Management Naming and Directories Distributed Systems Free count blocks free in bitmap Scheme Don t allocate data if count reserve How much reserve do you need In practice 10 seems like enough Email cs162 cory with conflicts Tradeoff pay for more disk get contiguous allocation Since seeks so expensive for performance this is a very good tradeoff 4 7 08 Joseph CS162 UCB Spring 2008 Projects have a grading standard 4 7 08 Lec 18 9 UNIX BSD 4 2 Same as BSD 4 1 same file header and triply indirect blocks except incorporated ideas from DEMOS Joseph CS162 UCB Spring 2008 Attack of the Rotational Delay Problem 2 Missing blocks due to rotational delay Issue Read one block do processing and read next block In meantime disk has continued turning missed next block Need 1 revolution block Uses bitmap allocation in place of freelist Attempt to allocate files contiguously 10 reserved disk space Skip sector positioning mentioned next slide Skip Sector Problem When create a file don t know how big it will become in UNIX most writes are by appending Track Buffer Holds complete track How much contiguous space do you allocate for a file In Demos power of 2 growth once it grows past 1MB allocate 2MB etc In BSD 4 2 just find some range of free blocks Solution1 Skip sector positioning interleaving
View Full Document
Unlocking...