1 / 16

CSI 400/500 Operating Systems Spring 2009

CSI 400/500 Operating Systems Spring 2009. Lecture #10 – File Manager Monday-Wednesday, March 2 nd and 4 th. File Directory File System File Manager. Collection of data in some organized fashion Organized collection of files Defined means of storing and manipulating files

tsweet
Télécharger la présentation

CSI 400/500 Operating Systems Spring 2009

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. CSI 400/500 Operating SystemsSpring 2009 Lecture #10 – File Manager Monday-Wednesday, March 2nd and 4th

  2. File Directory File System File Manager Collection of data in some organized fashion Organized collection of files Defined means of storing and manipulating files That part of the operating system that works with files and directories Terms

  3. Typical File Format • File is a collection of records • Each record is a collection of fields • Number and type of fields could vary across records (variable file) or remain constant (structured file) • Variable file require some translation format for copying data into storage • One job of file system is to hold these translations

  4. Open( ) Read(id, buffer, len) Write(…) Close( ) Establishes connection to file and sets position pointer at beginning Read a particular length of char data into specified I/O buffer. Moves position pointer len places Writes len characters from buffer to file Moves position pointer len places Removes copy from local storage Low-level file functions

  5. Seek function • Most modern operating systems have a seek function • Allows you to find particular character (like some delimiter) forward from position pointer (default) or from specified location • Doesn’t move position pointer • Use return value to determine read length

  6. Open( ) Get() Put() Seek() Close( ) Establishes connection to file and sets position pointer at beginning Reads next record Writes a new record Find particular record by index or key Removes copy from local storage Structured file functions

  7. Sequential Indexed sequential Inverted Consecutive records Must read in order Consecutive records Records have unique index field Can search Non-consecutive Find by index File types

  8. File Descriptor Block • Also called “file header” • Contains important information: • File name • File Owner • Permissions • Creation: Date, time, owner • Last modified: Date, time, user • System storage information: block size, file length, etc

  9. Open File Descriptor • Used on local open files • Contains file use information like: • Owning process id • Position pointer or record index position • Lock state: read or write • File copy state: open, archived, deleted, closed

  10. File Manager functions • Locate file and ensure permission • Create local copy – for files on external storage, may only get one block at a time • Create open file descriptor • Pass data between local copy and cache • Get additional external blocks • Manage storage • Clean up when close

  11. File Manager Storage Block Management • Managing blocks of data storage • Adding blocks, releasing blocks, and reallocating blocks • Arrangement is key difference in most operating systems • Contiguous • Linked list • Index table

  12. Contiguous Allocation • Files stored in consecutive blocks • Easy retrieval – File table maintains starting offset and length • Edit overhead – adding data means entire file moves to next free offset • Creates internal fragmentation

  13. Linked lists • Allows dynamic additions and subtractions • Individual records chained • Each record contains pointer to next • Often two-headed, so previous pointer exists • Lengthy search process • Run chain until desired record found

  14. Index table • Dynamic blocks contain records • Records can be scattered across secondary storage • Instant retrieval • Index table contains pointer to specific record with that index • Storage hog for large files • Index table gets larger and larger

  15. Hash table • Improvement over index table • Mix of linked lists and index table • Multiple records can have same “index” • Index table points to head of hash chain • Prevents need to extend index table

  16. Free Space • File Manager also maintains list of available space • Can be maintained with linked list chain, free space index table, or block status map • Block status map marks whether block is allocated or free

More Related