Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface.

Similar presentations


Presentation on theme: "Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface."— Presentation transcript:

1 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface

2 10.2 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Chapter 10: File-System Interface  File Concept  Access Methods  Directory Structure  File-System Mounting  File Sharing  Protection

3 10.3 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.4 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.5 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 File Operations  Create  Write  Read  Reposition within file  Delete  Truncate  Open(F i ) – search the directory structure on disk for entry F i, and move the content of entry to memory  Close (F i ) – move the content of entry F i in memory to directory structure on disk

6 10.6 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.7 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 File Types – Name, Extension

8 10.8 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.9 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Sequential-access File

10 10.10 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Simulation of Sequential Access on a Direct-access File

11 10.11 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Example of Index and Relative Files

12 10.12 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.13 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Directory Structure  A collection of nodes containing information about all files F 1 F 2 F 3 F 4 F n Directory Files Both the directory structure and the files reside on disk

14 10.14 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.15 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.16 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.17 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.18 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Tree-Structured Directories Directories can now contain files and subdirectories Efficient searching, allows grouping

19 10.19 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006  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 Path Names

20 10.20 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Acyclic-Graph Directories  Allow sharing of subdirectories and files

21 10.21 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Acyclic-Graph Directories (Cont.)  Two different names (aliasing)  If dict deletes list  dangling pointer Solutions: Backpointers, so we can delete all pointers Variable 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 10.22 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 General Graph Directory

23 10.23 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.24 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006  Mount allows two FSes to be merged into one For example you insert your floppy into the root FS: mount(“/dev/fd0”, “/mnt”, 0) File System Mounting

25 10.25 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.26 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.27 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 access1  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. ownergrouppublic chmod761game Attach a group to a file: chgrp G game

28 10.28 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.29 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Windows XP Access-control List Management

30 10.30 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.31 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 10.32 Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 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 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 End of Chapter 10


Download ppt "Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface."

Similar presentations


Ads by Google