1 / 32

File-System

File-System. Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012. File Concept. A file is an abstraction of logical address space A file is a named collection of related information that is recorded on secondary storage. Types: Text

taite
Télécharger la présentation

File-System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. File-System Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012

  2. File Concept • A file is an abstraction of logical address space • A file is a named collection of related information that is recorded on secondary storage. • Types: • Text • Source/object programs • Executable programs • Database records • Graphic images • Multimedia

  3. File Types – Name, Extension

  4. File Attributes • Name – 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. File Operations • Create • Write • Read • Reposition within file • Delete • Truncate • The other operations can be implemented by the primitive ones.

  6. 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

  7. Protection • File owner/creator should be able to control: • what can be done • by whom • Types of access • Read • Write • Execute • Append • Delete • List

  8. Access Lists and Groups • 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 access 1  0 0 1 • Ask administrator 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. owner group public chmod game 761 Attach a group to a file chgrp G game

  9. Windows XP Access-Control List Management

  10. A Sample UNIX Directory Listing

  11. A Typical File-system Organization

  12. A single directory for all users Single-Level Directory Efficiency problem Naming problem Grouping problem

  13. Separate directory for each user Two-Level Directory • Can have the same file name for different user • Efficient searching • Path name • No grouping capability

  14. Tree-Structured Directories

  15. Tree-Structured Directories (Cont.) • Efficient searching • Grouping Capability • Current directory (working directory) • Change directory: cd /spell/mail/prog • Directory/file sharing?

  16. Have shared subdirectories and files Acyclic-Graph Directories

  17. Acyclic-Graph Directories (Cont.) • Two different names (aliasing) • New directory entry type • Link – another name (pointer) to an existing file • Resolve the link – follow pointer to locate the file • If dict deletes list dangling pointer Solutions: • Backpointers, so we can delete all pointersVariable size records a problem • Entry-hold-count solution

  18. General Graph Directory

  19. File Allocation Methods • An allocation method refers to how disk blocks are allocated for files • Contiguous allocation • Linked allocation • Indexed allocation

  20. Contiguous Allocation • Contiguous allocation – each file occupies set of contiguous blocks • Best performance in most cases • Simple – only starting location (block #) and length (number of blocks) are required • Problems include finding space for file, knowing file size, external fragmentation, need for compaction off-line (downtime) or on-line

  21. Contiguous Allocation of Disk Space

  22. Linked Allocation • Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk

  23. Linked Allocation (Cont.)

  24. Linked Allocation (Cont.) • Linked allocation – each file is a linked list of blocks • File ends at nil pointer • No external fragmentation • Each block contains pointer to next block • No compaction, external fragmentation • Free space management system called when new block needed • Improve efficiency by clustering blocks into groups but increases internal fragmentation • Reliability can be a problem • Locating a block can take many I/Os and disk seeks

  25. File-Allocation Table (FAT) • FAT (File Allocation Table) variation • Beginning of volume has a table, indexed by block number • Much like a linked list, but faster on disk and cacheable • New block allocation simple • DOS / Windows

  26. Indexed Allocation • Indexed allocation • Each file has its own index block(s) of pointers to its data blocks • Logical view index table

  27. Example of Indexed Allocation

  28. Indexed Allocation – Mapping (Cont.)  outer-index blocks index table Multilevel Index

  29. Indexed Allocation – Mapping (Cont.) Combined Scheme with UNIX I-node

  30. I-node Example • Suppose a file system is constructed using blocks of 32 bytes. A pointer needs 4 bytes. The I-node structure is as follows (word, value): • Assume that free blocks are allocated in logical order starting with block 11. Also it has been determined that blocks 17 and 32 are bad and cannot be allocated. • Draw a block diagram showing the structure of the I-node and the blocks that are allocated for • Original file size of 3 blocks • Adding 4 blocks • Adding 17 blocks

  31. Indexed Allocation (Cont.) • Random access • Without external fragmentation • Need index table

  32. Homework • Reading • Chapter 10 and 11

More Related