Unformatted text preview:

1Chapter 11: File-System Interface File system is the most visible part of OS Consists of two parts (1) collection of files; (2) directory structure Overview File Concept Access Methods Directory Structure File System Mounting File Sharing  ProtectionFile Concept Contiguous logical address space, logical storage unit The OS abstracts from the physical properties of its storage devices Types:  Data numeric character binary ProgramFile Structure None - sequence of words, bytes Simple record structure Lines  Fixed length records Variable length records Complex Structures Formatted document such as Word Relocatable load file such as some EXE files For example the ELF binary format is common Would contain entry code that is executed before the real program. You need to know the structure to execute it  Exe files that are compiled with debugger information Would contain symbolic information, e.g., procedures and their addresses Can simulate last two with first method by inserting appropriatecontrol characters. Who decides: Operating system ProgramFile 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. Information about files are kept in the directory structure, which is maintained on the disk.File Operations Create (find space in file system and add entry to directory) Write (specify the file and data, write pointer) Read  Reposition within file – file seek Delete Truncate (attributes the same but erase content) 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 Fiin memory to directory structure on disk.File Types – Name, Extension2Access Methods Sequential Access (most common access method) Information in file processed in sequential orderread nextwrite next resetno read after last write Direct Access (or relative access) Allows arbitrary blocks to be read/writtenread nwrite nORposition to nread nextwrite next n = relative block numberSequential-access FileSimulation of Sequential Access on a Direct-access FileOther Access Methods:Example of Index and Relative Files• Index for file contains pointers to various blocks• Also index for the index file if it becomes too largeDirectory Structure A collection of nodes containing information about all files.F 1F 2F 3F 4F nDirectoryFilesBoth the directory structure and the files reside on disk.Backups of these two structures are kept on tapes.A Typical File-system Organization3Information in a Device Directory Device directory or commonly called directory Information for all files Name  Type Address  Current length Maximum length Date last accessed (for archival) Date last updated (for dump) Owner ID (who pays) Protection information (we discuss it later)Operations Performed on Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file systemOrganize the Directory (Logically) to Obtain Efficiency – locating a file quickly. Naming – convenient to users. Two users can have same name for different files. The same file can have several different names. Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, …)Single-Level Directory A single directory for all users.Naming problem (users call the files the same)Grouping problem (even with one user it is difficult to have one layer if you have many files, no grouping possible) Two-Level Directory Separate directory for each user.•Path name•Can have the same file name for different user•Efficient searching•No grouping capabilityTree-Structured Directories4Tree-Structured Directories (Cont.) Efficient searching Grouping Capability Current directory (working directory) cd /spell/mail/progTree-Structured Directories (Cont.) Absolute or relative path name Creating a new file is done in current directory. Delete a filerm <file-name> Creating a new subdirectory is done in current directory.mkdir <dir-name>Example: if in current directory /mailmkdir countmailprog copy prt exp countDeleting “mail”  deleting the entire subtree rooted by “mail”.Acyclic-Graph Directories Have shared subdirectories and files. (in Unix implemented with directory entries called links)Acyclic-Graph Directories (Cont.) Two different names (aliasing) If dict deletes list  dangling pointer.Solutions: Backpointers, so we can delete all pointers.General Graph DirectorySerious problem is that it is difficult to ensure that there are no cyclesGeneral Graph Directory (Cont.) How do we guarantee no cycles? Allow only links to file not subdirectories. Garbage collection. (difficult to support and not really used) Every time a new link is added use a cycle detectionalgorithm to determine whether it is OK.5File System Mounting A file system must be mounted before it can be accessed. A unmounted file system is mounted at a mount point. To mount the OS is given the name of the device and location within the file structure at which to attach the file system. Mounting also allows to use the from the mounting point to reach the directory(a) Existing. (b) Unmounted PartitionMount Point File Sharing Sharing of files on multi-user systems is desirable. Sharing may be done through a protection scheme. On distributed systems, files may be shared across a network. Network File System (NFS) is a common distributed file-sharing method.Protection File owner/creator should be able to control: what can be done by whom Types of access Read Write Execute Append Delete ListAccess Lists and Groups Mode of access: read, write, execute Three classes of usersRWXa) owner access 7  1 1 1RWXb) group access 6  1 1 0RWXc) 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


View Full Document

UMass Amherst ECE 397A - File-System Interface

Download File-System Interface
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view File-System Interface and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view File-System Interface 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?