Your SlideShare is downloading. ×
0
Chapter 10  File-System Interface
Contents <ul><li>File Concept </li></ul><ul><li>Access Methods </li></ul><ul><li>Directory Structure </li></ul><ul><li>Fil...
Objectives <ul><li>To explain the  function  of file systems </li></ul><ul><li>To describe the  interfaces  to file system...
Interface versus Implementation <ul><li>Interface : what you see, what you feel, how you handle it, … </li></ul><ul><li>Im...
10.1  File Concepts <ul><li>Computers store information on several  nonvolatile  media, such as </li></ul><ul><ul><li>magn...
File Concept <ul><li>A  file  is a  named collection  of related information that is recorded  on secondary storage </li><...
File Structure <ul><li>None - sequence of words, bytes </li></ul><ul><li>Simple record structure </li></ul><ul><ul><li>Lin...
10.1.1 File Attributes <ul><li>Name  – only information kept in human-readable form </li></ul><ul><li>Identifier  – unique...
10.1.2  File Operations <ul><li>Basic operations </li></ul><ul><ul><li>create (allocate space, make an entry in directory)...
File Operations <ul><li>To save constant search of the directory, many OS require the  open  and  close  system call </li>...
Open Files <ul><li>Several pieces of data are needed to manage open files: </li></ul><ul><ul><li>File pointer :  pointer t...
Open-file Tables <ul><li>A file can be opened simultaneously by more than one processes in name of several users </li></ul...
Open File Locking <ul><li>Provided by some operating systems and file systems </li></ul><ul><ul><li>a shared lock </li></u...
File Locking Example – Java API <ul><li>import java.io.*; </li></ul><ul><li>import java.nio.channels.*; </li></ul><ul><li>...
File Locking Example – Java API (cont) <ul><li>// this locks the second half of the file - shared </li></ul><ul><li>shared...
10.1.3  File Types – Name, Extension <ul><li>basename. extension </li></ul><ul><li>DOS, Windows </li></ul><ul><ul><li>.com...
10.1.4  File Structure <ul><li>File types may indicate the internal structure of the file </li></ul><ul><li>Certain files ...
10.1.5  Internal File Structure <ul><li>Logical blocks </li></ul><ul><ul><li>Unix OS defines all files to be simply a stre...
10.2  Access Methods <ul><li>Sequential Access </li></ul><ul><li>Direct Access (a.k.a. Random Access) </li></ul>
10.2.1 Sequential Access <ul><li>information in the file is processed in order, one record after the other </li></ul><ul><...
10.2.2  Direct Access <ul><li>Direct access (relative access) allows programs to read and write records rapidly in no part...
Simulation of Sequential Access  on a Direct-access File
10.2.3  Other Access Method Example of Index and Relative Files Other access methods can be built on top of a direct-acces...
10.3  Directory Structure <ul><li>File organization </li></ul><ul><ul><li>partition  (minidisk, volume) </li></ul></ul><ul...
A Typical File-system Organization <ul><li>several partitions may share a disk </li></ul><ul><li>a partition may span over...
10.3.2  Directory Overview <ul><li>A collection of nodes containing information about all files </li></ul>F 1 F 2 F 3 F 4 ...
Information in a Directory <ul><li>name  </li></ul><ul><li>type </li></ul><ul><li>address  </li></ul><ul><li>current lengt...
Operations Performed on Directory <ul><li>Search for a file </li></ul><ul><li>Create a file </li></ul><ul><li>Delete a fil...
Organize the Directory to Obtain … <ul><li>Efficiency  – locating a file quickly </li></ul><ul><li>Naming  – convenient to...
10.3.3 Single-Level Directory <ul><li>A single directory for all users </li></ul><ul><li>Naming problem </li></ul><ul><ul>...
10.3.4 Two-Level Directory <ul><li>Separate directory for each user </li></ul><ul><ul><li>master   file   directory  (MFD)...
10.3.5 Tree-Structured Directories
Tree-Structured Directories (Cont) <ul><li>Efficient searching </li></ul><ul><li>Grouping Capability </li></ul><ul><li>Cur...
Tree-Structured Directories (Cont) <ul><li>Absolute   path   name  begins at the root </li></ul><ul><li>Relative   path   ...
10.3.6  Acyclic-Graph Directories <ul><li>Have shared subdirectories and files </li></ul>
Acyclic-Graph Directories (Cont.) <ul><li>A file may have multiple absolute path names </li></ul><ul><ul><li>distinct file...
Unix/Linux solution <ul><li>hard link  (traditional link) </li></ul><ul><ul><li>a file is actually deleted only when the r...
10.3.7 General Graph Directory
General Graph Directory (Cont.) <ul><li>How do we guarantee no cycles? </li></ul><ul><ul><li>Allow only links to file not ...
10.4 File System Mounting <ul><li>A file system must be  mounted  before it can be accessed </li></ul><ul><ul><li>a direct...
Example (in Linux) <ul><li>mount /dev/… /users </li></ul><ul><li>the previous contents of the directory (at the mount poin...
10.5 File Sharing <ul><li>Sharing of files on multi-user systems is desirable </li></ul><ul><li>Sharing may be done throug...
10.5.1 Multiple Users <ul><li>The OS must mediate the file sharing </li></ul><ul><li>Access control and protection </li></...
*10.5.2 Remote File Systems <ul><li>Uses networking to allow file system access between systems </li></ul><ul><ul><li>Manu...
RFS – Failure Modes <ul><li>Remote file systems add new failure modes, due to network failure, server failure </li></ul><u...
10.5.3 Consistency Semantics <ul><li>Consistency semantics  specify how multiple users are to access a shared file simulta...
10.6 Protection <ul><li>File owner/creator should be able to control: </li></ul><ul><ul><li>what can be done </li></ul></u...
Access Lists and Groups <ul><li>Mode of access:  read, write, execute </li></ul><ul><li>Three classes of users </li></ul><...
A Sample UNIX Directory Listing
Windows XP Access-Control List
10.7  Summary <ul><li>a  file  is a named collection of information </li></ul><ul><li>a file is a sequence of  logical   r...
Summary <ul><li>directories  allow files to be organized </li></ul><ul><ul><li>single-level </li></ul></ul><ul><ul><li>two...
Summary <ul><li>a disk may divided into multiple  partitions , a partition (volume) may spans over disks </li></ul><ul><li...
Summary <ul><li>file  sharing  depends on the  semantics  provided by the OS </li></ul><ul><li>access control, protection ...
Homework <ul><li>Paper work </li></ul><ul><ul><li>1, 4, 7 </li></ul></ul><ul><li>Oral work </li></ul><ul><ul><li>all  the ...
Upcoming SlideShare
Loading in...5
×

Chapter 10 File-System Interface

1,211

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,211
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
59
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Chapter 10 File-System Interface"

  1. 1. Chapter 10 File-System Interface
  2. 2. Contents <ul><li>File Concept </li></ul><ul><li>Access Methods </li></ul><ul><li>Directory Structure </li></ul><ul><li>File-System Mounting </li></ul><ul><li>File Sharing </li></ul><ul><li>Protection </li></ul>
  3. 3. Objectives <ul><li>To explain the function of file systems </li></ul><ul><li>To describe the interfaces to file systems </li></ul><ul><li>To discuss file-system design tradeoffs , including access methods, file sharing, file locking, and directory structures </li></ul><ul><li>To explore file-system protection </li></ul>
  4. 4. Interface versus Implementation <ul><li>Interface : what you see, what you feel, how you handle it, … </li></ul><ul><li>Implementation : internal structures, made, basic flow </li></ul>
  5. 5. 10.1 File Concepts <ul><li>Computers store information on several nonvolatile media, such as </li></ul><ul><ul><li>magnetic disks (diskettes, floppy disks) </li></ul></ul><ul><ul><li>magnetic tapes </li></ul></ul><ul><ul><li>optical disks </li></ul></ul><ul><ul><li>solid-state disks (flash disks) </li></ul></ul><ul><li>The OS abstracts from the physical properties of its devices to define a logical storage unit – the file </li></ul>
  6. 6. File Concept <ul><li>A file is a named collection of related information that is recorded on secondary storage </li></ul><ul><li>Contiguous logical address space </li></ul><ul><li>Types: </li></ul><ul><ul><li>Data </li></ul></ul><ul><ul><ul><li>numeric </li></ul></ul></ul><ul><ul><ul><li>character </li></ul></ul></ul><ul><ul><ul><li>binary </li></ul></ul></ul><ul><ul><li>Program </li></ul></ul>
  7. 7. File Structure <ul><li>None - sequence of words, bytes </li></ul><ul><li>Simple record structure </li></ul><ul><ul><li>Lines </li></ul></ul><ul><ul><li>Fixed length </li></ul></ul><ul><ul><li>Variable length </li></ul></ul><ul><li>Complex structures </li></ul><ul><ul><li>Formatted document </li></ul></ul><ul><ul><li>Relocatable load file </li></ul></ul><ul><li>Can simulate last two with first method by inserting appropriate control characters </li></ul><ul><li>Who decides: </li></ul><ul><ul><li>Operating system </li></ul></ul><ul><ul><li>Program </li></ul></ul>
  8. 8. 10.1.1 File Attributes <ul><li>Name – only information kept in human-readable form </li></ul><ul><li>Identifier – unique tag (number) identifies file within file system </li></ul><ul><li>Type – needed for systems that support different types </li></ul><ul><li>Location – pointer to file location on device </li></ul><ul><li>Size – current file size </li></ul><ul><li>Protection – controls who can do reading, writing, executing </li></ul><ul><li>Time, date, and user identification – data for protection, security, and usage monitoring </li></ul><ul><li>Information about files are kept in the directory structure, which is maintained on the disk </li></ul>
  9. 9. 10.1.2 File Operations <ul><li>Basic operations </li></ul><ul><ul><li>create (allocate space, make an entry in directory) </li></ul></ul><ul><ul><li>write </li></ul></ul><ul><ul><li>read </li></ul></ul><ul><ul><li>reposition within file – file seek </li></ul></ul><ul><ul><li>delete </li></ul></ul><ul><ul><li>truncate (keep all attributes, reset to length zero) </li></ul></ul><ul><li>Other operations </li></ul><ul><ul><li>rename </li></ul></ul><ul><ul><li>copy </li></ul></ul><ul><ul><li>append </li></ul></ul>
  10. 10. File Operations <ul><li>To save constant search of the directory, many OS require the open and close system call </li></ul><ul><ul><li>open( F i ) – search the directory structure on disk for entry F i , and move the content of entry to memory </li></ul></ul><ul><ul><li>close( F i ) – move the content of entry F i in memory to directory structure on disk </li></ul></ul><ul><ul><ul><li>a file can be closed explicitly, or implicitly when the process aborts/terminates </li></ul></ul></ul>
  11. 11. Open Files <ul><li>Several pieces of data are needed to manage open files: </li></ul><ul><ul><li>File pointer : pointer to last read/write location, per process that has the file open </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>Disk location of the file: cache of data access information </li></ul></ul><ul><ul><li>Access rights : per-process access mode information </li></ul></ul>
  12. 12. Open-file Tables <ul><li>A file can be opened simultaneously by more than one processes in name of several users </li></ul><ul><li>A per-process table tracks all files that a process has open </li></ul><ul><ul><li>next read/write position, etc. </li></ul></ul><ul><ul><li>a pointer to an entry in the system-wide table </li></ul></ul><ul><li>A system-wide table contains process-independent information </li></ul><ul><ul><li>location on disk, access dates, file size, etc. </li></ul></ul><ul><ul><li>an open count tracks the number of processes </li></ul></ul>
  13. 13. Open File Locking <ul><li>Provided by some operating systems and file systems </li></ul><ul><ul><li>a shared lock </li></ul></ul><ul><ul><li>an exclusive lock </li></ul></ul><ul><li>Mediates access to a file </li></ul><ul><li>Mandatory or advisory </li></ul><ul><ul><li>Mandatory – access is denied depending on locks held and requested </li></ul></ul><ul><ul><li>Advisory – processes can find status of locks and decide what to do </li></ul></ul>
  14. 14. File Locking Example – Java API <ul><li>import java.io.*; </li></ul><ul><li>import java.nio.channels.*; </li></ul><ul><li>public class LockingExample { </li></ul><ul><li>public static final boolean EXCLUSIVE = false; </li></ul><ul><li>public static final boolean SHARED = true; </li></ul><ul><li>public static void main(String arsg[]) throws IOException { </li></ul><ul><li>FileLock sharedLock = null; </li></ul><ul><li>FileLock exclusiveLock = null; </li></ul><ul><li>try { </li></ul><ul><li>RandomAccessFile raf = new RandomAccessFile(&quot;file.txt&quot;, &quot;rw&quot;); </li></ul><ul><li>// get the channel for the file </li></ul><ul><li>FileChannel ch = raf.getChannel(); </li></ul><ul><li>// this locks the first half of the file - exclusive </li></ul><ul><li>exclusiveLock = ch.lock(0, raf.length()/2, EXCLUSIVE); </li></ul><ul><li>/** Now modify the data . . . */ </li></ul><ul><li>// release the lock </li></ul><ul><li>exclusiveLock.release(); </li></ul>
  15. 15. File Locking Example – Java API (cont) <ul><li>// this locks the second half of the file - shared </li></ul><ul><li>sharedLock = ch.lock(raf.length()/2+1, raf.length(), SHARED); </li></ul><ul><li>/** Now read the data . . . */ </li></ul><ul><li>// release the lock </li></ul><ul><li>exclusiveLock.release(); </li></ul><ul><li>} catch (java.io.IOException ioe) { </li></ul><ul><li>System.err.println(ioe); </li></ul><ul><li>}finally { </li></ul><ul><li>if (exclusiveLock != null) </li></ul><ul><li>exclusiveLock.release(); </li></ul><ul><li>if (sharedLock != null) </li></ul><ul><li>sharedLock.release(); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  16. 16. 10.1.3 File Types – Name, Extension <ul><li>basename. extension </li></ul><ul><li>DOS, Windows </li></ul><ul><ul><li>.com .exe </li></ul></ul><ul><ul><li>.bat </li></ul></ul><ul><ul><li>.asm .c </li></ul></ul><ul><ul><li>.obj </li></ul></ul><ul><li>Unix, Linux </li></ul><ul><ul><li>.c </li></ul></ul><ul><ul><li>.o </li></ul></ul><ul><ul><li>.tar .gz </li></ul></ul><ul><li>Macintosh </li></ul><ul><ul><li>store creator </li></ul></ul>
  17. 17. 10.1.4 File Structure <ul><li>File types may indicate the internal structure of the file </li></ul><ul><li>Certain files must conform to a required structure that is understood by the OS </li></ul><ul><ul><li>e.g. executable file, DLLs </li></ul></ul><ul><ul><li>a set of system supported files </li></ul></ul><ul><li>Unix, Linux and DOS support a minimal number of file structures </li></ul>
  18. 18. 10.1.5 Internal File Structure <ul><li>Logical blocks </li></ul><ul><ul><li>Unix OS defines all files to be simply a stream of bytes </li></ul></ul><ul><li>Physical blocks (on disk) </li></ul><ul><ul><li>a sector, typically 512 bytes </li></ul></ul><ul><li>packing – store a number of logical records into physical blocks </li></ul><ul><li>internal fragmentation : some waste portion of the last block of each file </li></ul>
  19. 19. 10.2 Access Methods <ul><li>Sequential Access </li></ul><ul><li>Direct Access (a.k.a. Random Access) </li></ul>
  20. 20. 10.2.1 Sequential Access <ul><li>information in the file is processed in order, one record after the other </li></ul><ul><ul><li>read next </li></ul></ul><ul><ul><li>write next </li></ul></ul><ul><ul><li>reset (rewind to the very beginning) </li></ul></ul><ul><ul><li>* skip forward or backward n records </li></ul></ul>
  21. 21. 10.2.2 Direct Access <ul><li>Direct access (relative access) allows programs to read and write records rapidly in no particular order read n </li></ul><ul><li>write n </li></ul><ul><li>position to n </li></ul><ul><li>read next </li></ul><ul><li>write next </li></ul><ul><li>rewrite n </li></ul><ul><li>n = relative block number </li></ul>
  22. 22. Simulation of Sequential Access on a Direct-access File
  23. 23. 10.2.3 Other Access Method Example of Index and Relative Files Other access methods can be built on top of a direct-access method
  24. 24. 10.3 Directory Structure <ul><li>File organization </li></ul><ul><ul><li>partition (minidisk, volume) </li></ul></ul><ul><ul><ul><li>can be smaller or larger than a physical disk drive </li></ul></ul></ul><ul><ul><ul><li>a logical/virtual disks </li></ul></ul></ul><ul><ul><ul><li>different partitions can store multiple OS </li></ul></ul></ul><ul><ul><li>directory </li></ul></ul><ul><ul><ul><li>name, location, size, type etc. for all files on that partition </li></ul></ul></ul>
  25. 25. A Typical File-system Organization <ul><li>several partitions may share a disk </li></ul><ul><li>a partition may span over several disks </li></ul>
  26. 26. 10.3.2 Directory Overview <ul><li>A collection of nodes containing information about all files </li></ul>F 1 F 2 F 3 F 4 F n Directory Files Both the directory structure and the files reside on disk Backups of these two structures are kept on tapes
  27. 27. Information in a Directory <ul><li>name </li></ul><ul><li>type </li></ul><ul><li>address </li></ul><ul><li>current length </li></ul><ul><li>maximum length </li></ul><ul><li>date last accessed (for archival) </li></ul><ul><li>date last updated (for dump) </li></ul><ul><li>owner ID (who pays) </li></ul><ul><li>protection information </li></ul>
  28. 28. Operations Performed on Directory <ul><li>Search for a file </li></ul><ul><li>Create a file </li></ul><ul><li>Delete a file </li></ul><ul><li>List a directory </li></ul><ul><li>Rename a file </li></ul><ul><li>Traverse the file system </li></ul>
  29. 29. Organize the Directory to Obtain … <ul><li>Efficiency – locating a file quickly </li></ul><ul><li>Naming – convenient to users </li></ul><ul><ul><li>Two users can have same name for different files </li></ul></ul><ul><ul><li>The same file can have several different names </li></ul></ul><ul><li>Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, …) </li></ul>
  30. 30. 10.3.3 Single-Level Directory <ul><li>A single directory for all users </li></ul><ul><li>Naming problem </li></ul><ul><ul><li>require unique names </li></ul></ul><ul><ul><li>limited name length (e.g. DOS 8.3, Unix 255) </li></ul></ul><ul><ul><li>Grouping problem </li></ul></ul>
  31. 31. 10.3.4 Two-Level Directory <ul><li>Separate directory for each user </li></ul><ul><ul><li>master file directory (MFD) </li></ul></ul><ul><ul><li>user file directory (UFD) </li></ul></ul><ul><li>Path name </li></ul><ul><li>Can have the same file name for different user </li></ul><ul><li>Efficient searching </li></ul><ul><li>No grouping capability </li></ul><ul><ul><li>users may want to share files </li></ul></ul>
  32. 32. 10.3.5 Tree-Structured Directories
  33. 33. Tree-Structured Directories (Cont) <ul><li>Efficient searching </li></ul><ul><li>Grouping Capability </li></ul><ul><li>Current directory (working directory) </li></ul><ul><ul><li>cd /spell/mail/prog </li></ul></ul><ul><ul><li>type list </li></ul></ul>
  34. 34. Tree-Structured Directories (Cont) <ul><li>Absolute path name begins at the root </li></ul><ul><li>Relative path name is a path from the current directory </li></ul><ul><li>Creating a new file is done in current directory </li></ul><ul><li>Delete a file </li></ul><ul><li>rm <file-name> </li></ul><ul><li>Creating a new subdirectory is done in current directory </li></ul><ul><ul><li>mkdir <dir-name> </li></ul></ul><ul><li>Example: if in current directory /mail </li></ul><ul><li>mkdir count </li></ul>mail prog copy prt exp count Deleting “mail”  deleting the entire subtree rooted by “mail”
  35. 35. 10.3.6 Acyclic-Graph Directories <ul><li>Have shared subdirectories and files </li></ul>
  36. 36. Acyclic-Graph Directories (Cont.) <ul><li>A file may have multiple absolute path names </li></ul><ul><ul><li>distinct file names may refer to the same file </li></ul></ul><ul><li>Problems </li></ul><ul><ul><li>disk usage (quota) calculation </li></ul></ul><ul><ul><li>backup </li></ul></ul><ul><ul><li>deletion </li></ul></ul><ul><ul><ul><li>dangling pointers to non-existent file, and even worse, to the disk address reused by other files (maybe in the middle) </li></ul></ul></ul>
  37. 37. Unix/Linux solution <ul><li>hard link (traditional link) </li></ul><ul><ul><li>a file is actually deleted only when the reference count hits zero </li></ul></ul><ul><ul><li>limit: file only, same file system </li></ul></ul><ul><li>symbolic link (soft link) </li></ul><ul><ul><li>can spans over file systems (volumes) </li></ul></ul><ul><ul><li>can link to a directory </li></ul></ul><ul><ul><li>Windows use the same approach ( short-cut ) </li></ul></ul><ul><li>lab exercise </li></ul>
  38. 38. 10.3.7 General Graph Directory
  39. 39. General Graph Directory (Cont.) <ul><li>How do we guarantee no cycles? </li></ul><ul><ul><li>Allow only links to file not subdirectories </li></ul></ul><ul><ul><li>Garbage collection </li></ul></ul><ul><ul><li>Every time a new link is added use a cycle detection algorithm to determine whether it is OK </li></ul></ul>
  40. 40. 10.4 File System Mounting <ul><li>A file system must be mounted before it can be accessed </li></ul><ul><ul><li>a directory structure can be built out of multiple partitions </li></ul></ul><ul><li>An unmounted file system is mounted at a mount point , the location with the directory structure </li></ul><ul><li>Example </li></ul><ul><ul><li>mount /dev/hda5 /mnt/diskD </li></ul></ul><ul><ul><li>umount /dev/hda5 </li></ul></ul><ul><ul><li>umount /mnt/diskD </li></ul></ul>
  41. 41. Example (in Linux) <ul><li>mount /dev/… /users </li></ul><ul><li>the previous contents of the directory (at the mount point) becomes invisible as long as the (new) file system remains mounted </li></ul><ul><li>a file system may be mounted only once </li></ul>existing unmounted partition mount point
  42. 42. 10.5 File Sharing <ul><li>Sharing of files on multi-user systems is desirable </li></ul><ul><li>Sharing may be done through a protection scheme </li></ul><ul><li>On distributed systems, files may be shared across a network </li></ul><ul><li>Network File System (NFS) is a common distributed file-sharing method </li></ul>
  43. 43. 10.5.1 Multiple Users <ul><li>The OS must mediate the file sharing </li></ul><ul><li>Access control and protection </li></ul><ul><ul><li>owner (user), who may change attributes, grant access, has the most control over the file and directory </li></ul></ul><ul><ul><li>group , a subset of users who may share access to the file </li></ul></ul><ul><li>User identifiers (uid) and group identifies (gid) are associated with all of the user’s processes and threads </li></ul><ul><ul><li>a user can be in one or more groups, depending on the OS </li></ul></ul><ul><ul><li>User IDs identify users, allowing permissions and protections to be per-user </li></ul></ul><ul><ul><li>Group IDs allow users to be in groups, permitting group access rights </li></ul></ul><ul><li>User IDs and group IDs are stored with other file or directory attributes </li></ul><ul><li>The user information within a process are compared to the attributes of the file or directory to determine which permissions are applicable </li></ul>
  44. 44. *10.5.2 Remote File Systems <ul><li>Uses networking to allow file system access between systems </li></ul><ul><ul><li>Manually via programs like FTP </li></ul></ul><ul><ul><li>Automatically, seamlessly using distributed file systems </li></ul></ul><ul><ul><li>Semi automatically via the world wide web </li></ul></ul><ul><li>Client-server model allows clients to mount remote file systems from servers </li></ul><ul><ul><li>Server can serve multiple clients </li></ul></ul><ul><ul><li>Client and user-on-client identification is insecure or complicated </li></ul></ul><ul><ul><li>NFS is standard UNIX client-server file sharing protocol </li></ul></ul><ul><ul><li>CIFS is standard Windows protocol </li></ul></ul><ul><ul><li>Standard operating system file calls are translated into remote calls </li></ul></ul><ul><li>Distributed Information Systems ( distributed naming services ) such as LDAP, DNS, NIS, Active Directory implement unified access to information needed for remote computing </li></ul>
  45. 45. RFS – Failure Modes <ul><li>Remote file systems add new failure modes, due to network failure, server failure </li></ul><ul><li>Recovery from failure can involve state information about status of each remote request </li></ul><ul><li>Stateless protocols such as NFS include all information in each request, allowing easy recovery but less security </li></ul>
  46. 46. 10.5.3 Consistency Semantics <ul><li>Consistency semantics specify how multiple users are to access a shared file simultaneously) </li></ul><ul><ul><li>Andrew File System (AFS) implemented complex remote file sharing semantics </li></ul></ul><ul><li>Unix file system (UFS) implements: </li></ul><ul><ul><li>Writes to an open file visible immediately to other users of the same open file </li></ul></ul><ul><ul><li>Sharing file pointer to allow multiple users to read and write concurrently </li></ul></ul><ul><ul><ul><li>pointer moved by one user affects all sharing users </li></ul></ul></ul><ul><li>AFS has session semantics </li></ul><ul><ul><li>Writes only visible to sessions starting after the file is closed </li></ul></ul>
  47. 47. 10.6 Protection <ul><li>File owner/creator should be able to control: </li></ul><ul><ul><li>what can be done </li></ul></ul><ul><ul><li>by whom </li></ul></ul><ul><li>Types of access </li></ul><ul><ul><li>Read </li></ul></ul><ul><ul><li>Write </li></ul></ul><ul><ul><li>Execute </li></ul></ul><ul><ul><li>Append </li></ul></ul><ul><ul><li>Delete </li></ul></ul><ul><ul><li>List </li></ul></ul>
  48. 48. Access Lists and Groups <ul><li>Mode of access: read, write, execute </li></ul><ul><li>Three classes of users </li></ul><ul><li>RWX </li></ul><ul><li>a) owner access 7  1 1 1 RWX </li></ul><ul><li>b) group access 6  1 1 0 </li></ul><ul><li>RWX </li></ul><ul><li>c) public access 1  0 0 1 </li></ul><ul><li>Ask manager to create a group (unique name), say G, and add some users to the group. </li></ul><ul><li>For a particular file (say game ) or subdirectory, define an appropriate access. </li></ul>Attach a group to a file chgrp G game owner group public chmod 761 game
  49. 49. A Sample UNIX Directory Listing
  50. 50. Windows XP Access-Control List
  51. 51. 10.7 Summary <ul><li>a file is a named collection of information </li></ul><ul><li>a file is a sequence of logical records </li></ul><ul><ul><li>a logical record may be a byte, a line, fixed or variable length structure, etc. </li></ul></ul><ul><ul><li>an OS may support various record types, or leave that support to the application programs </li></ul></ul><ul><li>basic operations : read, write, etc. </li></ul>
  52. 52. Summary <ul><li>directories allow files to be organized </li></ul><ul><ul><li>single-level </li></ul></ul><ul><ul><li>two-level, allow multiple users </li></ul></ul><ul><ul><li>tree-structured </li></ul></ul><ul><ul><li>acyclic-graph </li></ul></ul><ul><ul><ul><li>(hard) link , symbolic link </li></ul></ul></ul><ul><li>directory includes information about files </li></ul><ul><ul><li>name, location on disk, length, type, owner, time of creation, time of last use, access control list, etc. </li></ul></ul>
  53. 53. Summary <ul><li>a disk may divided into multiple partitions , a partition (volume) may spans over disks </li></ul><ul><li>a volume (file system) should be mounted before use, and unmounted to disable access </li></ul>
  54. 54. Summary <ul><li>file sharing depends on the semantics provided by the OS </li></ul><ul><li>access control, protection </li></ul><ul><ul><li>file attributes: owner (creator), group </li></ul></ul><ul><ul><li>user identity: uid, gid </li></ul></ul><ul><ul><li>type of access: read, write, execute, append, delete, list directory, etc. </li></ul></ul>
  55. 55. Homework <ul><li>Paper work </li></ul><ul><ul><li>1, 4, 7 </li></ul></ul><ul><li>Oral work </li></ul><ul><ul><li>all the remaining problems </li></ul></ul><ul><li>Lab exercise (on Linux) </li></ul><ul><ul><li>link, symbolic link </li></ul></ul><ul><ul><li>permissions and protections </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×