0
Part III  Storage ManagementChapter 10: File-System Interface
FilesqA file is a named collection of related information that is recorded on secondary storage.qThe operating systems map...
File AttributesqFile Name: The symbolic name is perhaps the only human readable file attribute.qIdentifier: A unique numbe...
File Operations: 1/2qA file can be considered as an abstract data type that has data and accompanying operations.qCreating...
File Operations: 2/2                                                        disk         system-wide                    pr...
File StructureqSome systems support specific file types that have special file structures.qFor example, files that contain...
File Access MethodsqAccess method: how a file be used.qThere are three popular ones: vSequential access method for sequent...
Sequential Access Method qWith the sequential access method, the file is  processed in order, one record after the other. ...
Direct Access MethodqA file is made up of fixed-length logical records.qThe direct access method uses record number to ide...
Indexed Access MethodqWith the indexed access method, a file is sorted in ascending order based on a number of keys.qEach ...
data file        index tablelast name logical rec #Adams                      Ashcroft, … Asher, … AtkinsArthurAshcroft   ...
Directory Structure: 1/2qA large volume disk may be partitioned into partitions, or mini disks, or volumes.qEach partition...
Directory Structure: 2/2qThere are five commonly used directory structures:  vSingle-Level Directory  vTwo-Level Directory...
Single-Level DirectoryqAll files are contained in the same directory.qIt is difficult to maintain file name uniqueness.qCP...
Two-Level Directory: 1/2qThis is an extension of the single-level directory for multi-user system.qEach user has his/her u...
Two-Level Directory: 2/2qTo locate a file, path name is used. For example, /user2/bo is the file bo of user 2.qDifferent s...
Tree-Structured DirectoryqEach directory or subdirectory contains files and subdirectories, and forms a tree.qDirectories ...
Acyclic-Graph Directory: 1/2                                   qThis type of directories                                  ...
Acyclic-Graph Directory: 2/2qSince a file have multiple absolute path names, how do we calculate file system statistics or...
General Graph Directory: 1/2qIt is easy to traverse the directories of a tree or an acyclic directory system.qHowever, if ...
General Graph Directory: 2/2qHow do we delete a file? We can use reference count!  vIn a cycle, due to self-reference, the...
File SharingqWhen a file is shared by multiple users, how can we ensure its consistency?qIf multiple users are writing to ...
File Consistency SemanticsqConsistency semantics is a characterization of the system that specifies the semantics of multi...
Unix SemanticsqWrites to an open file by a user are visible immediately to other users have the file open at the same time...
Session SemanticsqWrites to an open file by a user are not visible immediately to other users that have the same file open...
Immutable-Shared-Files Semantics qOnce a file is declared as shared by its creator, it  cannot be modified. qAn immutable ...
File ProtectionqWe can keep files safe from physical damage (i.e., reliability) and improper access (i.e., protection).qRe...
File Protection: Types of Access qAccess control may be implemented by limiting  the types of file access that can be made...
File Protection: Access Control: 1/4  qThe most commonly used approach is to make   the access dependent on the identity o...
File Protection: Access Control: 2/4                       Access Matrix          File 1 File 2 File 3 File 4   Account 1 ...
File Protection: Access Control: 3/4          A     B    CFile 1   Own          R          W               R     R        ...
File Protection: Access Control: 4/4         File 1   File 3User A   Own      Own         Capability Lists           R    ...
Upcoming SlideShare
Loading in...5
×

File system

1,679

Published on

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

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

No notes for slide

Transcript of "File system"

  1. 1. Part III Storage ManagementChapter 10: File-System Interface
  2. 2. FilesqA file is a named collection of related information that is recorded on secondary storage.qThe operating systems maps this logical storage unit to the physical view of information storage.qA file may have the following characteristics vFile Attributes vFile Operations vFile Types vFile Structures vInternal Files
  3. 3. File AttributesqFile Name: The symbolic name is perhaps the only human readable file attribute.qIdentifier: A unique number assigned to each file for identification purpose.qFile Type: Some systems recognize various file types. Windows is a good example.qFile Location: A pointer to a device to find a file.qFile Size: The current size of a file, or the maximum allowed size.qFile Protection: This is for access-control.qFile Date, Time, Owner, etc.
  4. 4. File Operations: 1/2qA file can be considered as an abstract data type that has data and accompanying operations.qCreating a fileqWriting a fileqReading a fileqRepositioning within a fileqDeleting a fileqTruncating a fileqOther operations (e.g., appending a file, renaming a file)
  5. 5. File Operations: 2/2 disk system-wide process open-file table open-file table filefile index file pointer file open count one file disk location access right
  6. 6. File StructureqSome systems support specific file types that have special file structures.qFor example, files that contain binary executables.qAn operating system becomes more complex when more file types (i.e., file structures) are supported.qIn general, the number of supported file types is kept to minimum.
  7. 7. File Access MethodsqAccess method: how a file be used.qThere are three popular ones: vSequential access method for sequential files vDirect access method for direct files vIndexed access method for indexed files.
  8. 8. Sequential Access Method qWith the sequential access method, the file is processed in order, one record after the other. qIf p is the file pointer, the next record to be accessed is either p+1 or p-1 (i.e., backspace). current recordbeginning end of file next record rewind read/write
  9. 9. Direct Access MethodqA file is made up of fixed-length logical records.qThe direct access method uses record number to identify each record. For example, read rec 0, write rec 100, seek rec 75, etc.qSome systems may use a key field to access a record (e.g., read rec “Age=24” or write rec “Name=Dow”). This is usually achieved using hashing.qSince records can be accessed in random order, direct access is also referred to as random access.qDirect access method can simulate sequential access.
  10. 10. Indexed Access MethodqWith the indexed access method, a file is sorted in ascending order based on a number of keys.qEach disk block may contain a number of fixed- length logical records.qAn index table stores the keys of the first block in each block.qWe can search the index table to locate the block that contains the desired record. Then, search the block to find the desired record.qThis is exactly a one-level B-, B+ or B* tree.qMulti-level index access method is also possible.
  11. 11. data file index tablelast name logical rec #Adams Ashcroft, … Asher, … AtkinsArthurAshcroft Smith, …. Sweeny, … Swell, …Smithindex table is storedIn physical memory
  12. 12. Directory Structure: 1/2qA large volume disk may be partitioned into partitions, or mini disks, or volumes.qEach partition contains information about files within it. This information is stored in entries of a device directory or volume table of content (VTOC).qThe device directory, or directory for short, stores the name, location, size, type, access method, etc of each file.qOperations perform on directory: search for a file, create a file, delete a file, rename a file, traverse the file system, etc.
  13. 13. Directory Structure: 2/2qThere are five commonly used directory structures: vSingle-Level Directory vTwo-Level Directory vTree-Structure Directories vAcyclic-Graph Directories vGeneral Graph Directories
  14. 14. Single-Level DirectoryqAll files are contained in the same directory.qIt is difficult to maintain file name uniqueness.qCP/M-80 and early version of MS-DOS use this directory structure.
  15. 15. Two-Level Directory: 1/2qThis is an extension of the single-level directory for multi-user system.qEach user has his/her user file directory. The system’s master file directory is searched for the user directory when a user job starts.qEarly CP/M-80 multi-user systems use this structure.
  16. 16. Two-Level Directory: 2/2qTo locate a file, path name is used. For example, /user2/bo is the file bo of user 2.qDifferent systems use different path names. For example, under MS-DOS it may be C:user2bo.qThe directory of a special user, say user 0, may contain all system files.
  17. 17. Tree-Structured DirectoryqEach directory or subdirectory contains files and subdirectories, and forms a tree.qDirectories are special files. /bin/mail/prog/spell
  18. 18. Acyclic-Graph Directory: 1/2 qThis type of directories allows a file/directory to be shared by multiple directories. qThis is different from two copies of the same file or directory. qAn acyclic-graph directory is more flexible than a simplefile count is shared by directories tree structure.dict and spell However, it is more complex.
  19. 19. Acyclic-Graph Directory: 2/2qSince a file have multiple absolute path names, how do we calculate file system statistics or do backup? Would the same file be duplicated multiple times?qHow do we delete a file? vIf sharing is implemented with symbolic links, we only delete the link if we have a list of links to the file. The file is removed when the list is empty. vOr, we remove the file and keep the links. When the file is accessed again, a message is given and the link is removed. vOr, we can maintain a reference count for each shared file. The file is removed when the count is zero.
  20. 20. General Graph Directory: 1/2qIt is easy to traverse the directories of a tree or an acyclic directory system.qHowever, if links are added arbitrarily, the directory graph becomes arbitrary and may contain cycles.qHow do we search for a file? a cycle
  21. 21. General Graph Directory: 2/2qHow do we delete a file? We can use reference count! vIn a cycle, due to self-reference, the reference count may be non-zero even when it is no longer possible to refer to a file or directory. vThus, garbage collection may needed. A garbage collector traverses the directory and marks files and directories that can be accessed. vA second round removes those inaccessible items.qTo avoid this time-consuming task, a system can check if a cycle may occur when a link is made. How? You should know!
  22. 22. File SharingqWhen a file is shared by multiple users, how can we ensure its consistency?qIf multiple users are writing to the file, should all of the writers be allowed to write?qOr, should the operating system protect the user actions from each other?qThis is the file consistency semantics.
  23. 23. File Consistency SemanticsqConsistency semantics is a characterization of the system that specifies the semantics of multiple users accessing a shared file simultaneously.qConsistency semantics is an important criterion for evaluating any file system that supports file sharing.qThere are three commonly used semantics vUnix semantics vSession Semantics vImmutable-Shared-Files SemanticsqA file session consists all file access between open() and close().
  24. 24. Unix SemanticsqWrites to an open file by a user are visible immediately to other users have the file open at the same time.qAll users share the file pointer. Thus, advancing the file pointer by one user affects all sharing users.qA file has a single image that interleaves all accesses, regardless of their origin.
  25. 25. Session SemanticsqWrites to an open file by a user are not visible immediately to other users that have the same file open simultaneously.qOnce a file is closed, the changes made to it are visible only in sessions started later.qAlready-open instances of the file do not affect these changes. vA file may be associated temporarily with several and possible different images at the same time. vMultiple users are allowed to perform both read and write concurrently on their image of the file without delay.qThe Andrew File System (AFS) uses this semantics.
  26. 26. Immutable-Shared-Files Semantics qOnce a file is declared as shared by its creator, it cannot be modified. qAn immutable file has two important properties: vIts name may not be used vIts content may not be altered qThus, the name of an immutable file indicates that the contents of the file is fixed – a constant rather than a variable. qThe implementation of these semantics in a distributed system is simple, since sharing is disciplined (i.e., read-only).
  27. 27. File ProtectionqWe can keep files safe from physical damage (i.e., reliability) and improper access (i.e., protection).qReliability is generally provided by backup.qThe need for file protection is a direct result of the ability to access files.qAccess control may be a complete protection by denying access. Or, the access may be controlled.
  28. 28. File Protection: Types of Access qAccess control may be implemented by limiting the types of file access that can be made. qThe types of access may be vRead: read from the file vWrite: write or rewrite the file vExecute: load the file into memory and execute it vAppend: write new info at the end of a file vDelete: delete a file vList: list the name and attributes of the file
  29. 29. File Protection: Access Control: 1/4 qThe most commonly used approach is to make the access dependent on the identity of the user. qEach file and directory is associated with an access matrix specifying the user name and the types of permitted access. qWhen a user makes a request to access a file or a directory, his/her identity is compared against the information stored in the access matrix.
  30. 30. File Protection: Access Control: 2/4 Access Matrix File 1 File 2 File 3 File 4 Account 1 Account 2 Own Own Inquiry User A R R Credit W W Own Inquiry Inquiry User B R R R debit Credit W W Own Inquiry User C R R R debit W W
  31. 31. File Protection: Access Control: 3/4 A B CFile 1 Own R W R R W Access-control ListsFile 2 B Own C qIn practice, the access R W R matrix is sparse. qThe matrix can be A BFile 3 Own decomposed into R W W columns (files), yielding access-control lists (ACL)File 4 B C qHowever, this list can be Own R R very long! W
  32. 32. File Protection: Access Control: 4/4 File 1 File 3User A Own Own Capability Lists R R W WUser B File 1 File 2 Own File 3 File 4 qDecomposition R W R W R by rows (users) yields capability File 1 File 2 File 4 tickets.User C R R Own R qEach user has a W W number ticket for file/directory access.
  1. A particular slide catching your eye?

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

×