1 / 16

File Concept

File Concept. Contiguous logical address space Smallest user allocation Non-volatile Types: Data numeric character binary Program Source Script Binary. File Types – Name, Extension. File Structure. Levels of structuring None - sequence of words, bytes Simple record structure

bendek
Download Presentation

File Concept

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 Concept • Contiguous logical address space • Smallest user allocation • Non-volatile • Types: • Data • numeric • character • binary • Program • Source • Script • Binary Operating System Concepts

  2. File Types – Name, Extension Operating System Concepts

  3. 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 Operating System Concepts

  4. 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. Operating System Concepts

  5. Directory Structure • A collection of nodes containing information about all files. Directory Files F 1 F 2 F 3 F 4 F n • Both the directory structure and the files reside on disk. Operating System Concepts

  6. 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) Operating System Concepts

  7. 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) Operating System Concepts

  8. 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 Operating System Concepts

  9. 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 Operating System Concepts

  10. Tree-Structured Directories Operating System Concepts

  11. 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 Operating System Concepts

  12. Acyclic-Graph Directories Operating System Concepts

  13. 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 Operating System Concepts

  14. 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 detectionalgorithm to determine whether it is OK. Operating System Concepts

  15. 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 Operating System Concepts

  16. 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 access 1  0 0 1 • Password protection • Files (too many) • Subdirectories (ala TOPS-20) • Partition (ala VM/CMS) • All user files Operating System Concepts

More Related