1 / 33

Chapter 10: File-System Interface

Chapter 10: File-System Interface. Chapter 10: File-System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection. Objectives. To explain the function of file systems To describe the interfaces to file systems

emma
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

  2. Chapter 10: File-System Interface • File Concept • Access Methods • Directory Structure • File-System Mounting • File Sharing • Protection

  3. Objectives • To explain the function of file systems • To describe the interfaces to file systems • To discuss file-system design tradeoffs, including access methods, file sharing, file locking, and directory structures • To explore file-system protection

  4. File Attributes • Name – only information kept in human-readable form • Identifier – unique tag (number) identifies file within file system • 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

  5. File Operations • Create • Write • Read • Reposition within file • Delete • 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

  6. Open Files • Several pieces of data are needed to manage open files: • File pointer: pointer to last read/write location, per process that has the file open • File-open count: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it • Disk location of the file: cache of data access information • Access rights: per-process access mode information

  7. File Types – Name, Extension

  8. 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

  9. Sequential-access File

  10. Simulation of Sequential Access on a Direct-access File

  11. Example of Index and Relative Files

  12. A Typical File-system Organization • Could use entire disk for FS, but • system could have multiple FS types (e.g., swap) • Disk divided into miniature disks called partitions or slices

  13. Directory Structure • A collection of nodes containing information about all files Directory Files F 1 F 2 F 3 F 4 F n Both the directory structure and the files reside on disk

  14. Operations Performed on Directory • List directory contents • Search for a file • Create a file • Delete a file • Rename a file • Traverse the file system

  15. Organize 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, …)

  16. Single-Level Directory • A single directory for all users • Called the root directory • Pros: Simple, easy to quickly locate files • Cons: inconvenient naming (uniqueness), no grouping

  17. Two-Level Directory • Separate directory for each user • Introduces the notion of a path name • Can have the same file name for different user • Efficient searching • No grouping capability

  18. Tree-Structured Directories • Directories can now contain files and subdirectories • Efficient searching, allows grouping

  19. Path Names • To access a file, the user should either: • Go to the directory where file resides, or • Specify the path where the file is • Path names are either absolute or relative • Absolute: path of file from the root directory • Relative: path from the current working directory • Most OSes have two special entries in each directory: • “.” for current directory and “..” for parent

  20. Acyclic-Graph Directories • Allow sharing of subdirectories and files

  21. Acyclic-Graph Directories (Cont.) • Two different names (aliasing) • If dict deletes list dangling pointer Solutions: • Backpointers, so we can delete all pointersVariable size records a problem • Backpointers using a daisy chain organization • Reference count for each file • New directory entry type • Link – another name (pointer) to an existing file • Resolve the link – follow pointer to locate the file

  22. General Graph Directory

  23. General Graph Directory (Cont.) • How do we guarantee no cycles? • Allow only links to files not subdirectories • Garbage collection • Every time a new link is added use a cycle detection algorithm to determine whether it is OK

  24. File System Mounting • Mount allows two FSes to be merged into one • For example you insert your floppy into the root FS: mount(“/dev/fd0”, “/mnt”, 0)

  25. Protection • File owner/creator should be able to control: • what can be done • by whom • Types of access • Read • Write • Execute • Append • Delete • List

  26. Categories of Users • Individual user • Log in establishes a user-id • Might be just local on the computer or could be through interaction with a network service • Groups to which the user belongs • For example, “nahum” is in “w4118” • Again could just be automatic or could involve talking to a service that might assign, say, a temporary cryptographic key

  27. owner group public chmod 761 game UNIX Access Rights • Mode of access: read, write, execute • Three classes of users RWX a) owner access 7  1 1 1 RWX b) group 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. Attach a group to a file: chgrp G game

  28. Issues with UNIX Access Rights • Just a single owner, a single group and the public • Pro: Compact enough to fit in just a few bytes • Con: Not very expressive • Access Control List: This is a per-file list that tells who can access that file • Pro: Highly expressive • Con: Harder to represent in a compact way

  29. Windows XP Access-control List Management

  30. File Sharing • Sharing of files on multi-user systems is desirable • Sharing may be done through the protection scheme • On distributed systems, files may be shared across a network • Use a distributed file system such as Network File System (NFS) • Use distributed naming systems such as NIS, LDAP, Active Directory for network-wide user information

  31. Remote File System Mounting • Same idea, but file system is actually on some other machine • Implementation uses remote procedure call • Package up the user’s file system operation • Send it to the remote machine where it gets executed like a local request • Remote sends back the answer • Very common in modern systems • E.g., the CLIC lab, compute nodes, etc.

  32. File Sharing – Client-Server Model • Client-server model allows clients to mount remote file systems from servers • Server can serve multiple clients • NFS is a standard UNIX client-server file sharing protocol • Multiple versions; V4 is standard now • We use it on CLIC, compute nodes • CIFS is standard Windows protocol • Standard operating system file calls are translated into remote procedure calls • Package up the user’s file system operation • Send it to the remote machine where it gets executed like a local request • Remote sends back the answer

  33. End of Chapter 10

More Related