how are file systems implemented
play

How are file systems implemented? ! How do we represent CSCI - PDF document

How are file systems implemented? ! How do we represent CSCI [4|6]730 Directories (link file names to file structure) Operating Systems The list of blocks containing the data Other information such as access control list or


  1. How are file systems implemented? ! How do we represent CSCI [4|6]730 » Directories (link file names to file “structure”) Operating Systems » The list of blocks containing the data » Other information such as access control list or permissions, owner, time of access, etc? File System: Implementation ! How can we be smart about the layout? Maria Hybinette, UGA Maria Hybinette, UGA File System Design Motivations File System Design Motivation (cont) ! Access patterns: ! Workloads influence design of file system » Sequential: Data in file is read/written in order ! File characteristics (measurements of UNIX and – Most common access pattern NT): » Random (direct): Access block without referencing the predecessor block » Most files are small (about 8KB) – Difficult to optimize – Block size can’t be too big (why not?) » Access files in same directory together – Is this still true? Why? – Spatial locality » BUT - Most of the disk is allocated to large files » Access meta-data (i-node, FCB) when access file – Need meta-data to find data – (90% of data is in 10% of number of files) – Large file access should be reasonable efficient. ! Support various file access patterns ! Maria Hybinette, UGA Maria Hybinette, UGA File Operation Implementation File Operation Implementation ! Repositioning within a file: ! Create a file: » Directory searched for appropriate entry & current file position » Find space in the file system, and add a directory entry. pointer is updated (also called a file seek ) ! Writing in a file: ! Deleting a file: » System call specifying name & information to be written. » Search directory entry for named file, release associated file – Given name, system searches directory structure to find file. System keeps write pointer to the location where next write occurs, updating space and erase directory entry as writes are performed. Update meta-data. ! Truncating a file: ! Reading a file: » Keep attributes the same, but reset file size to 0, and reclaim file » System call specifying name of file & where in memory to stick space. contents. Name is used to find file, and a read pointer is kept to point to next read position. (can combine write & read to current file position pointer ). Update meta-data. Thought Questions : How should files be accessed on reads and writes? How can we avoid reading/searching directory on every read/write access? Maria Hybinette, UGA Maria Hybinette, UGA

  2. Opening Files ! Observation: Expensive to access files with full pathnames » On every read/write operation: ! Need to caches open file pointers – Traverse directory structure – Check access permissions » HINT: we have file descriptors in UNIX, it is a reason for this. ! Idea!: open() file before first access ! How do we do this procedurally? » User specifies mode: read and/or write » Search directories once for filename and check permissions » Copy relevant meta-data to system wide open file table in memory » Return index in open file table to process (file descriptor) » Process uses file descriptor to read/write to file ! Multi-process support: via a separate per-process-open file table where each process maintains » Current file position in file (offset for read/write) » Open mode Maria Hybinette, UGA Maria Hybinette, UGA Multi-Process File Access Example: Accessing Files Support (Steps via Open) 1. Search directory structure ! Two level of internal tables: (part may be cached in user space kernel space disk space memory) » Per-process open file table 2. Get meta-data, copy (if directory structure – Tracks all files open by a process (process- needed) into system-wide open( *filename ) � centric information): open file table ‘in-core’ directory structure file meta-data ! Current position pointer (read/write), access 3. Adjust count of #processes user space kernel space disk space Rights that have file open ! Index in system-wide table 4. Entry made in per-process file data blocks » System-wide open file table open file table, w/ pointer read( fd ) � per-process system-wide to system wide table file meta data open file table open file table – Process Independent information 5. Return pointer to entry in ! Location of file on disk per-process file table to ! Access dates, file size application ! File open count (# processes accessing file) Maria Hybinette, UGA Maria Hybinette, UGA Goals Allocation Strategies ! OS allocates logical block numbers (LBN) to meta-data, ! Progression of different approaches (reminiscent of memory structure ‘progression’ of approaches) file data, and directory data » Contiguous » Workload items accessed together should be close in LBN space » Extent-based ! Implications » Linked » File-allocation Tables » Large files should be allocated sequentially » Indexed » Files in same directory should be allocated near each other » Multi-level Indexed » Data should be allocated near its meta-data ! Questions ! Meta-Data: Where is it (or should it be) stored on disk? » Amount of fragmentation (internal and external)? » Embedded within each directory entry » Ability to grow file over time? » In data structure separate from directory entry » Seek cost for sequential accesses? – Directory entry points to meta-data » Speed to find data blocks for random accesses? » Wasted space for pointers to data blocks? Maria Hybinette, UGA Maria Hybinette, UGA

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend