1 / 14

Chapter 10: File-System Interface

Chapter 10: File-System Interface. What is a file-system? An abstract representation of physical devices capable of storing and retrieving binary information (files) consists of partitions (volumes (NT), minidisks, etc), directories, and files

beck-head
Download Presentation

Chapter 10: File-System Interface

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. Chapter 10: File-System Interface • What is a file-system? • An abstract representation of physical devices capable of storing and retrieving binary information (files) • consists of partitions (volumes (NT), minidisks, etc), directories, and files • “virtual” file-systems may be smaller or greater in size then the physical devices used to store the information • What is a file? • A file is an abstract data type, defined by the operations that can be performed on them • A named collection of related information recorded on a secondary storage (non-volatile) device • Uniform logical view of information storage • A logical storage unit (mapped by the OS onto a physical device) • Who decides how the meaning is encoded (structure)? • Operating system • Program CEG 433/633 - Operating Systems I

  2. File Attributes • A file is a sequence of bits, bytes, lines or records whose format encodes meaning as defined by the file’s creator or user: • “Freeform” structure: sequence of words, bytes • Simple regular structure: fixed or variable length records • Complex structures: formatted document, relocatable load file • Filetypes: • Data (numeric, character, binary) • Executable (loader can bring into memory and execute) • Directory (keeps information about other files) • Attributes: • Name – only information kept in human-readable form. • Type – needed for systems that support different types. • Location – pointer to file location on device. • Size – current file size. • Protection – controls who can do reading, writing, executing. • Time, date, and user identification – data for protection, security, and usage monitoring. CEG 433/633 - Operating Systems I

  3. File Types – name, extension CEG 433/633 - Operating Systems I

  4. Access Methods • Sequential Access read next write next reset no read after last write (rewrite) • Direct Access read n write n position to n read next write next rewrite n n = relative block number CEG 433/633 - Operating Systems I

  5. File Operations • Files are an abstract data type, defined by the operations that can be performed on the. The OS must provide system calls for the following types of operations: • create: find space, write to file, update directory • write: name and position, update size, update file pointer • read: name and position, update file pointer • seek: reposition within file, update file pointer • delete: deallocate space, erase directory entry • truncate • open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory. • close (Fi) – move the content of entry Fi in memory to directory structure on disk. • Files must be explicitly opened via open() to create a entry in the open-file table. The index to the entry in the open-file table is the “file handle”. • # of processes w/ current-file position pointer (offset) for each • Information regarding physical location of file on disk CEG 433/633 - Operating Systems I

  6. F 1 F 2 F 3 F 4 F n Directory Structure • A collection of nodes containing information about all files. • Operations: • Search for a file • Create a file • Delete a file • List a directory • Rename a file • Traverse the file system Directory Files • Both the directory structure and the files reside on disk. • Backups of these two structures are kept on tapes. CEG 433/633 - Operating Systems I

  7. Single-Level Directory • A single directory for all files (all users). • Naming problem • Each file must have a unique name - • it may be difficult to keep track of “used” names • What if two users want to use the same filename? • What if two users have the _same_ file under two different names? • Grouping problem • files are not grouped by logical properties (C programs, games, etc.) • Efficiency – how can you locate a file quickly (if you don’t know the name…) CEG 433/633 - Operating Systems I

  8. Two-Level Directory • Separate directory for each user. • Path name • Can have the same file name for different user • Efficient searching • No grouping capability CEG 433/633 - Operating Systems I

  9. Tree-Structured Directories • Efficient searching • Grouping Capability • Current directory (working directory) • cd /spell/mail/prog • type list CEG 433/633 - Operating Systems I

  10. Tree-Structured Directories (Cont.) • Absolute or relative path name • Creating a new file is done in current directory. • Delete a file rm <file-name> • Creating a new subdirectory is done in current directory. mkdir <dir-name> Example: if in current directory /spell/mail mkdir count mail prog copy prt exp count • Deleting “mail”  deleting the entire subtree rooted by “mail”. CEG 433/633 - Operating Systems I

  11. Acyclic-Graph Directories • Have shared subdirectories and files. • Different names (aliasing) • Solutions: • Backpointers, so we can delete all pointers.Variable size records a problem. • Backpointers using a daisy chain organization. • Entry-hold-count solution. CEG 433/633 - Operating Systems I

  12. General Graph Directory • How do we guarantee no cycles? • Allow only links to file not subdirectories. • Garbage collection. • Every time a new link is added use a cycle detectionalgorithm to determine whether it is OK. CEG 433/633 - Operating Systems I

  13. Protection • File owner/creator should be able to control: • what can be done • by whom • Types of access • Read • Write • Execute • Append • Delete • List • Access Lists • Access Control Lists (ACLs) CEG 433/633 - Operating Systems I

  14. Access Lists and Groups in UNIX • Mode of access: read, write, execute • Three classes of users RWX a) owner access 7  1 1 1 RWX b) groups access 6  1 1 0 RWX c) public access 1  0 0 1 • Ask manager to create a group (unique name), say G, and add some users to the group. • For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game • Attach a group to a file chgrpG game CEG 433/633 - Operating Systems I

More Related