Bài giảng Operating System Concepts - Module 10: File-System Interface

Tài liệu Bài giảng Operating System Concepts - Module 10: File-System Interface: Module 10: File-System InterfaceFile ConceptAccess :MethodsDirectory Structure ProtectionConsistency SemanticsOperating System ConceptsFile ConceptContiguous logical address spaceTypes: DatanumericcharacterbinaryProgramOperating System ConceptsFile StructureNone - sequence of words, bytesSimple record structureLines Fixed lengthVariable lengthComplex StructuresFormatted documentRelocatable load file Can simulate last two with first method by inserting appropriate control characters.Who decides:Operating systemProgramOperating System ConceptsFile AttributesName – 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.Information about files are kept in the directory structure, which is maintained on the disk.Operating System...

ppt22 trang | Chia sẻ: honghanh66 | Lượt xem: 990 | Lượt tải: 0download
Bạn đang xem trước 20 trang mẫu tài liệu Bài giảng Operating System Concepts - Module 10: File-System Interface, để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên
Module 10: File-System InterfaceFile ConceptAccess :MethodsDirectory Structure ProtectionConsistency SemanticsOperating System ConceptsFile ConceptContiguous logical address spaceTypes: DatanumericcharacterbinaryProgramOperating System ConceptsFile StructureNone - sequence of words, bytesSimple record structureLines Fixed lengthVariable lengthComplex StructuresFormatted documentRelocatable load file Can simulate last two with first method by inserting appropriate control characters.Who decides:Operating systemProgramOperating System ConceptsFile AttributesName – 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.Information about files are kept in the directory structure, which is maintained on the disk.Operating System ConceptsFile Operationscreatewritereadreposition within file – file seekdeletetruncateopen(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.Operating System ConceptsFile Types – name, extensionOperating System ConceptsAccess MethodsSequential 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 numberOperating System ConceptsDirectory StructureA collection of nodes containing information about all files.F 1F 2F 3F 4F nDirectoryFilesBoth the directory structure and the files reside on disk.Backups of these two structures are kept on tapes.Operating System ConceptsInformation in a Device DirectoryName TypeAddress Current lengthMaximum lengthDate last accessed (for archival)Date last updated (for dump)Owner ID (who pays)Protection information (discuss later)Operating System ConceptsOperations Performed on DirectorySearch for a fileCreate a fileDelete a fileList a directoryRename a fileTraverse the file systemOperating System ConceptsOrganize the Directory (Logically) to ObtainEfficiency – 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 Pascal programs, all games, )Operating System ConceptsSingle-Level DirectoryA single directory for all users.Naming problemGrouping problemOperating System ConceptsTwo-Level DirectorySeparate directory for each user.Path nameCan have the saem file name for different userEfficient searchingNo grouping capabilityOperating System ConceptsTree-Structured DirectoriesOperating System ConceptsTree-Structured Directories (Cont.)Efficient searchingGrouping CapabilityCurrent directory (working directory)cd /spell/mail/progtype listOperating System ConceptsTree-Structured Directories (Cont.)Absolute or relative path nameCreating a new file is done in current directory.Delete a file rm Creating a new subdirectory is done in current directory. mkdir Example: if in current directory /spell/mail mkdir countmailprogcopyprtexpcountDeleting “mail”  deleting the entire subtree rooted by “mail”.Operating System ConceptsAcyclic-Graph DirectoriesHave shared subdirectories and files.Operating System ConceptsAcyclic-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.Entry-hold-count solution.Operating System ConceptsGeneral Graph DirectoryOperating System ConceptsGeneral Graph Directory (Cont.)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.Operating System ConceptsProtectionFile owner/creator should be able to control:what can be doneby whomTypes of accessReadWriteExecuteAppendDeleteListOperating System ConceptsAccess Lists and GroupsMode of access: read, write, executeThree classes of users RWX a) owner access 7  1 1 1 RWX b) groups access 6  1 1 0 RWX c) public access 1  0 0 1Ask 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.ownergrouppublicchmod761gameAttach a group to a file chgrp G gameOperating System Concepts

Các file đính kèm theo tài liệu này:

  • pptch10_4043.ppt
Tài liệu liên quan