Bài giảng Operating system Concepts - Chapter 11: File System Interface

ppt 30 trang huongle 2630
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Operating system Concepts - Chapter 11: File System Interface", để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên

Tài liệu đính kèm:

  • pptbai_giang_operating_system_concepts_chapter_11_file_system_i.ppt

Nội dung text: Bài giảng Operating system Concepts - Chapter 11: File System Interface

  1. Chapter 11: File-System Interface n File Concept n Access Methods n Directory Structure n File System Mounting n File Sharing n Protection Operating System Concepts 11.1 Silberschatz, Galvin and Gagne 2002
  2. File Concept n Contiguous logical address space n Types: F Data 4 numeric 4 character 4 binary F Program Operating System Concepts 11.2 Silberschatz, Galvin and Gagne 2002
  3. File Structure n None - sequence of words, bytes n Simple record structure F Lines F Fixed length F Variable length n Complex Structures F Formatted document F Relocatable load file n Can simulate last two with first method by inserting appropriate control characters. n Who decides: F Operating system F Program Operating System Concepts 11.3 Silberschatz, Galvin and Gagne 2002
  4. File Attributes n Name – only information kept in human-readable form. n Type – needed for systems that support different types. n Location – pointer to file location on device. n Size – current file size. n Protection – controls who can do reading, writing, executing. n Time, date, and user identification – data for protection, security, and usage monitoring. n Information about files are kept in the directory structure, which is maintained on the disk. Operating System Concepts 11.4 Silberschatz, Galvin and Gagne 2002
  5. File Operations n Create n Write n Read n Reposition within file – file seek n Delete n Truncate n Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory. n Close (Fi) – move the content of entry Fi in memory to directory structure on disk. Operating System Concepts 11.5 Silberschatz, Galvin and Gagne 2002
  6. File Types – Name, Extension Operating System Concepts 11.6 Silberschatz, Galvin and Gagne 2002
  7. Access Methods n Sequential Access read next write next reset no read after last write (rewrite) n Direct Access read n write n position to n read next write next rewrite n n = relative block number Operating System Concepts 11.7 Silberschatz, Galvin and Gagne 2002
  8. Sequential-access File Operating System Concepts 11.8 Silberschatz, Galvin and Gagne 2002
  9. Simulation of Sequential Access on a Direct-access File Operating System Concepts 11.9 Silberschatz, Galvin and Gagne 2002
  10. Example of Index and Relative Files Operating System Concepts 11.10 Silberschatz, Galvin and Gagne 2002
  11. Directory Structure n A collection of nodes containing information about all files. Directory Files F 2 F 4 F 1 F 3 F n Both the directory structure and the files reside on disk. Backups of these two structures are kept on tapes. Operating System Concepts 11.11 Silberschatz, Galvin and Gagne 2002
  12. A Typical File-system Organization Operating System Concepts 11.12 Silberschatz, Galvin and Gagne 2002
  13. Information in a Device Directory n Name n Type n Address n Current length n Maximum length n Date last accessed (for archival) n Date last updated (for dump) n Owner ID (who pays) n Protection information (discuss later) Operating System Concepts 11.13 Silberschatz, Galvin and Gagne 2002
  14. Operations Performed on Directory n Search for a file n Create a file n Delete a file n List a directory n Rename a file n Traverse the file system Operating System Concepts 11.14 Silberschatz, Galvin and Gagne 2002
  15. Organize the Directory (Logically) to Obtain n Efficiency – locating a file quickly. n Naming – convenient to users. F Two users can have same name for different files. F The same file can have several different names. n Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, ) Operating System Concepts 11.15 Silberschatz, Galvin and Gagne 2002
  16. Single-Level Directory n A single directory for all users. Naming problem Grouping problem Operating System Concepts 11.16 Silberschatz, Galvin and Gagne 2002
  17. Two-Level Directory n Separate directory for each user. •Path name •Can have the same file name for different user •Efficient searching •No grouping capability Operating System Concepts 11.17 Silberschatz, Galvin and Gagne 2002
  18. Tree-Structured Directories Operating System Concepts 11.18 Silberschatz, Galvin and Gagne 2002
  19. Tree-Structured Directories (Cont.) n Efficient searching n Grouping Capability n Current directory (working directory) F cd /spell/mail/prog F type list Operating System Concepts 11.19 Silberschatz, Galvin and Gagne 2002
  20. Tree-Structured Directories (Cont.) n Absolute or relative path name n Creating a new file is done in current directory. n Delete a file rm n Creating a new subdirectory is done in current directory. mkdir Example: if in current directory /mail mkdir count mail prog copy prt exp count Deleting “mail” deleting the entire subtree rooted by “mail”. Operating System Concepts 11.20 Silberschatz, Galvin and Gagne 2002
  21. Acyclic-Graph Directories n Have shared subdirectories and files. Operating System Concepts 11.21 Silberschatz, Galvin and Gagne 2002
  22. Acyclic-Graph Directories (Cont.) n Two different names (aliasing) n If dict deletes list dangling pointer. Solutions: F Backpointers, so we can delete all pointers. Variable size records a problem. F Backpointers using a daisy chain organization. F Entry-hold-count solution. Operating System Concepts 11.22 Silberschatz, Galvin and Gagne 2002
  23. General Graph Directory Operating System Concepts 11.23 Silberschatz, Galvin and Gagne 2002
  24. General Graph Directory (Cont.) n How do we guarantee no cycles? F Allow only links to file not subdirectories. F Garbage collection. F Every time a new link is added use a cycle detection algorithm to determine whether it is OK. Operating System Concepts 11.24 Silberschatz, Galvin and Gagne 2002
  25. File System Mounting n A file system must be mounted before it can be accessed. n A unmounted file system (I.e. Fig. 11-11(b)) is mounted at a mount point. Operating System Concepts 11.25 Silberschatz, Galvin and Gagne 2002
  26. (a) Existing. (b) Unmounted Partition Operating System Concepts 11.26 Silberschatz, Galvin and Gagne 2002
  27. Mount Point Operating System Concepts 11.27 Silberschatz, Galvin and Gagne 2002
  28. File Sharing n Sharing of files on multi-user systems is desirable. n Sharing may be done through a protection scheme. n On distributed systems, files may be shared across a network. n Network File System (NFS) is a common distributed file- sharing method. Operating System Concepts 11.28 Silberschatz, Galvin and Gagne 2002
  29. Protection n File owner/creator should be able to control: F what can be done F by whom n Types of access F Read F Write F Execute F Append F Delete F List Operating System Concepts 11.29 Silberschatz, Galvin and Gagne 2002
  30. Access Lists and Groups n Mode of access: read, write, execute n 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 n Ask manager to create a group (unique name), say G, and add some users to the group. n 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 Operating System Concepts 11.30 Silberschatz, Galvin and Gagne 2002