Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10: File-System Interface

Similar presentations


Presentation on theme: "Chapter 10: File-System Interface"— 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 CEG 433/633 - Operating Systems I
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 File types: 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 CEG 433/633 - Operating Systems I
Access Methods Sequential Access read next write next reset no read after last write (rewrite) Direct Access read n write n position to n rewrite n n = relative block number CEG 433/633 - Operating Systems I

5 CEG 433/633 - Operating Systems I
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 CEG 433/633 - Operating Systems I
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 F 1 F 2 F 3 F 4 F n 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 CEG 433/633 - Operating Systems I
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 detection algorithm to determine whether it is OK. CEG 433/633 - Operating Systems I

13 CEG 433/633 - Operating Systems I
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  RWX b) groups access 6  1 1 0 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 chgrp G game CEG 433/633 - Operating Systems I


Download ppt "Chapter 10: File-System Interface"

Similar presentations


Ads by Google