1 / 21

Simplified File System CS 3SH3: Operating Systems Concepts

Simplified File System CS 3SH3: Operating Systems Concepts. Husam Ibrahim Taghreed Al Ramahi. Outline. Motivation Structure How it all works Limitations Questions. Motivation. Every user is unique Some users store mostly large files E.g. A user with many media files

hertz
Télécharger la présentation

Simplified File System CS 3SH3: Operating Systems Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simplified File SystemCS 3SH3: Operating Systems Concepts Husam Ibrahim Taghreed Al Ramahi CS 3SH3 - Operating System Concepts - Winter 2006 (McMaster University)

  2. Outline • Motivation • Structure • How it all works • Limitations • Questions

  3. Motivation • Every user is unique • Some users store mostly large files • E.g. A user with many media files • Others store mostly small files • E.g. A company computer used for tracking databases • If most files are large, there will be few files • Need only a few inodes • If most files are small, there will be many files • Need many inodes

  4. Why not fixed inodes? • With N fixed inodes • Assumes the number/size of files user needs • If N is too small • Users who create mostly small files will run out of inodes • If N is too big • Users who create mostly large files will have empty inodes wasting space

  5. Solution? • Our design allocates inodes dynamically • Every time a file is created, an inode is allocated to it • Very flexible • Also works well for users that have a mix of small and large files • Maximum utilization of available space

  6. StructureSuperblock • Uses a bit vector • Each block is represented by one bit • Uses an array of type char • Char disk_bitmap[512] uses exactly 512 bytes • Each 4 bits are grouped into a number between 0 and 15 • The compressed array is also of type char • This results in an array of exactly 128 bytes • Can fit in one block!

  7. StructureiNode Table • First 2 bytes used for File Pointer • File pointer is part of the inode • Each block index uses 2 bytes • Six direct indices • Next 14 bytes used for direct block indexing • An entire inode takes up 16 bytes • Can have 128/16 or 8 inodes per disk block

  8. StructureiNumbers • Virtually every block can contain either an inode or data • If it contains an inode, how do we differentiate between them? • Need a universal inumber scheme • Since each block can contain up to 8 inodes, there are 512x8 or 4096 possible iNumbers • E.g. Where is inode w/ inumber 210? • 210/8 = 26 R 2 • It is the 3rd Inode in Block #26 • Inumber-to-block-number translation handled by simple division and modulus operations

  9. StructureDirectories • First 2 bytes are for the inumber of the entry • Next 6 bytes are for the Filename • Final byte is always null character • Each entry takes up 8 bytes • Can fit 128/8 or 16 bytes in a block

  10. StructurePathname Parsing • Pathnames are parsed in a similar way to given model • As the name is read, it is placed into a 2D array. • E.g. /new/file is parsed into

  11. Normal Operation • When the system is newly initialized (and under any other condition), the following blocks are always occupied: • Block #0: Superblock • Block #1: Inode of Root Dir and next 7 files • Block #511: Directory Data of Root Dir

  12. How it Works… • When a file is created • The system calls empty_inode_search to get an inode • All the inode tables are searched (starting from the first) • If an empty one is found, its inode number is returned • The system then calls get_empty_block to get a new data block for it • Note: get_empty_block has an extra argument for direction • 1 From the top • 0 From the bottom • For an inode table, it uses 1 • For a data block, it uses 0

  13. How it Works…(cont’d…) • This ensures that inode tables and data blocks don’t overlap • If the inode that is returned is the last one in its table, a new table is created in the next block • Therefore, as long as there’s space, empty_inode_search will always find a free inode • This will continue until disk is full

  14. Limitations(Number of Files) • If the system consists of small files only • Each block holds 8 inodes • Each inode occupies 1/8th of a block • Each data block occupies 1 block • So when it’s full, the system can hold 454 files/directories consisting of one data block each

  15. Limitations(Number of Files cont’d…) • If the system consists of large files only • Each file has 7 data blocks • So when it’s full, the system can hold 71 files/directories consisting of one data block each • The average case is somewhere between there • Still >150 files

  16. Limitations(Other limitations) • File size • Maximum file size = • Number of Files Open Simultaneously • Limited by amount of memory allocated to file descriptor array. • Currently set to 128, but easily changeable. • Maximum Number of Directory Entries • Each directory (like a file) can have up to 7 direct address blocks. • Each directory data block can hold up to 16 entries. This means that each directory can hold up to 112 entries. • Block-boundary crossing is allowed

  17. XFS • Are there any file systems similar to this in practice? • In 1996, SGI came up with XFS [1] • Focused on Scalability [1] • Dynamic inode allocation, logging volume manager, … [1] • Inodes are placed closer to files • Facilitates greater performance [2]

  18. Different Unix File Systems [2]

  19. Experience & Improvements • Experience • Found modularization to be very helpful • Spending more time/thorough testing of lower level libraries paid off • Future Improvements • Learn about other File Systems used in Unix • Provide tutorials earlier • Makefiles • Linux • Design proposal instead of documentation specifications

  20. Any Questions?

  21. Resources • [1] http://infohost.nmt.edu/~val/fs_slides.pdf • [2] http://www.uoks.uj.edu.pl/resources/flugor/IRIX/xfs-whitepaper.html

More Related