Presentation is loading. Please wait.

Presentation is loading. Please wait.

Silberschatz, Galvin and Gagne  2002 11.1 Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.

Similar presentations


Presentation on theme: "Silberschatz, Galvin and Gagne  2002 11.1 Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile."— Presentation transcript:

1 Silberschatz, Galvin and Gagne  2002 11.1 Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile Types:  Data  numeric  character  binary  Program  Source  Script  Binary

2 Silberschatz, Galvin and Gagne  2002 11.2 Operating System Concepts File Types – Name, Extension

3 Silberschatz, Galvin and Gagne  2002 11.3 Operating System Concepts File Structure Levels of structuring  None - sequence of words, bytes  Simple record structure  Lines  Fixed length  Variable length  Complex structures  Formatted document  Relocatable load file  Can simulate last two with first method by inserting appropriate control characters. Need at least executable binary and data Type indicated by  “type” extension  Resource fork (Mac)  Magic number (UNIX) More complexity requires more OS support

4 Silberschatz, Galvin and Gagne  2002 11.4 Operating System Concepts File Attributes Name – 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 – creation, access, modification. 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 Silberschatz, Galvin and Gagne  2002 11.5 Operating System Concepts Directory Structure A collection of nodes containing information about all files. F 1 F 2 F 3 F 4 F n Directory Files Both the directory structure and the files reside on disk.

6 Silberschatz, Galvin and Gagne  2002 11.6 Operating System Concepts File Operations Create  Allocate space  Create directory entry Open  Copy the directory structure on disk to memory. Read, Write  Identified file  Specified position  Specified data  Update directory Reposition within file – file seek Close  Copy the directory structure in memory to disk. Delete  Release space  Delete directory entry Rename, Truncate, Append, Copy (can be formed from others)

7 Silberschatz, Galvin and Gagne  2002 11.7 Operating System Concepts Access Methods Sequential Access read next write next reset (rewind) no read after last write Direct Access read n write n position to n read next write next n = relative block number (start, current, end)

8 Silberschatz, Galvin and Gagne  2002 11.8 Operating System Concepts Directory Operations Search for a file  By name/pattern  By other attributes Create a file  Add a new entry Delete a file  Delete entry List a directory Rename a file  Potentially moves file in directory structure Traverse the file system  E.g., for backups

9 Silberschatz, Galvin and Gagne  2002 11.9 Operating System Concepts Organize the Directory (Logically) to Obtain Efficiency – locating a file quickly Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, …) Naming – convenient to users.  Two users can have same name for different files.  The same file can have several different names

10 Silberschatz, Galvin and Gagne  2002 11.10 Operating System Concepts Tree-Structured Directories

11 Silberschatz, Galvin and Gagne  2002 11.11 Operating System Concepts Tree-Structured Directories Efficient searching Grouping capability Absolute and relative pathnames  Relative to current directory  Absolute to  Root  Current (which absolute to root) No sharing yet

12 Silberschatz, Galvin and Gagne  2002 11.12 Operating System Concepts Acyclic-Graph Directories

13 Silberschatz, Galvin and Gagne  2002 11.13 Operating System Concepts Acyclic-Graph Directories Have shared subdirectories and files  Allows multiple names for one file or directory  Allows sharing of files and directories Hard links  Multiple directory nodes refer to the same file  No precedence  Problems of directory entry consistency - UNIX solves with inodes  Delete file (only) when there are no links  Alternatively, have back pointers and delete all directory entries and file when one directory entry is deleted  Beware cyclic directory links (not permitted in UNIX now) Symbolic (soft) links  Gives name of another directory entry (could also be soft)  Deletion just deletes the link  Have to deal with hanging links when hard link is deleted  Cyclic links are possible

14 Silberschatz, Galvin and Gagne  2002 11.14 Operating System Concepts General Graph Directory 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.

15 Silberschatz, Galvin and Gagne  2002 11.15 Operating System Concepts Protection File owner/creator should be able to control:  what can be done  by whom Modes access:  Files: read, write, execute, delete  Directories: read, write, make current

16 Silberschatz, Galvin and Gagne  2002 11.16 Operating System Concepts Access Lists and Groups Access lists provide fine grained control (Windows NT)  Very large  Requires variable size directory entries Classes of users RWX a) owner access 7  1 1 1 RWX b) group access 6  1 1 0 RWX c) public access1  0 0 1 Password protection  Files (too many)  Subdirectories (ala TOPS-20)  Partition (ala VM/CMS)  All user files


Download ppt "Silberschatz, Galvin and Gagne  2002 11.1 Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile."

Similar presentations


Ads by Google