Tài liệu Bài giảng Operating System Concepts - Chapter 11: File-System Interface: Chapter 11: File-System InterfaceFile ConceptAccess MethodsDirectory StructureFile System MountingFile Sharing ProtectionOperating 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.O...
30 trang |
Chia sẻ: honghanh66 | Lượt xem: 997 | Lượt tải: 0
Bạn đang xem trước 20 trang mẫu 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
Chapter 11: File-System InterfaceFile ConceptAccess MethodsDirectory StructureFile System MountingFile Sharing ProtectionOperating 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 ConceptsSequential-access FileOperating System ConceptsSimulation of Sequential Access on a Direct-access FileOperating System ConceptsExample of Index and Relative FilesOperating 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 ConceptsA Typical File-system OrganizationOperating 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 Java 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 same 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 /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 detectionalgorithm to determine whether it is OK.Operating System ConceptsFile System MountingA file system must be mounted before it can be accessed.A unmounted file system (I.e. Fig. 11-11(b)) is mounted at a mount point.Operating System Concepts(a) Existing. (b) Unmounted PartitionOperating System ConceptsMount PointOperating System ConceptsFile SharingSharing of files on multi-user systems is desirable.Sharing may be done through a protection scheme.On distributed systems, files may be shared across a network.Network File System (NFS) is a common distributed file-sharing method.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) group 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:
- ch11_3273.ppt