Unformatted text preview:

ICS 143 - Principles of Operating Systems Lectures 14 and 15 - FileSystem Interface and Implementation Prof. Dmitri V. Kalashnikov dvk (@) ics.uci.edu Slides © Prof. Nalini Venkatasubramanian.Outline n File Concept and Structure n Directory Structures n File Organizations n Access Methods n ProtectionFile Concept q Contiguous logical address space n OS abstracts from the physical properties of its storage device to define a logical storage unit called file. n Persistent n OS maps files to physical devices. q Types n Data q numeric, character, binary n Program q source, object (load image) n DocumentsFile Structure q None - sequence of words/bytes q Simple record structure q Lines q Fixed Length q Variable Length q Complex Structures q Formatted document q Relocatable Load File q Can simulate last two with first method by inserting appropriate control characters q Who decides q Operating System q ProgramFile Attributes q Name q symbolic file-name, only information in human-readable form q Identifier q Unique tag that identifies file within filesystem; non-human readable name q Type - q for systems that support multiple types q Location - q pointer to a device and to file location on device q Size - q current file size, maximal possible size q Protection - q controls who can read, write, execute q Time, Date and user identification q data for protection, security and usage monitoring q Information about files are kept in the directory structure, maintained on diskFile types - name.extension File Type Possible extension FunctionExecutable Exe,com,bin Machine languageprogramObject Obj, o Compiled machine lang.,not linkedSource code c, CC, p, java, asm… Source code in variouslanguagesBatch Bat, sh Commands to commandinterpretertext Txt, doc Textual data, documentsPrint, view ps, dvi, gif ASCII or binary filearchive Arc, zip, tar Group of files, sometimescompressedLibrary Lib, a Libraries of routinesFile Operations q A file is an abstract data type. It can be defined by operations: n Create a file n Write a file n Read a file n Reposition within file - file seek n Delete a file n Truncate a file n Open(Fi) q search the directory structure on disk for entry Fi, and move the content of entry to memory. n Close(Fi) q move the content of entry Fi in memory to directory structure on disk.Directory Structure q Number of files on a system can be extensive q Break file systems into partitions ( treated as a separate storage device) q Hold information about files within partitions. q Device Directory: A collection of nodes containing information about all files on a partition. q Both the directory structure and files reside on disk. q Backups of these two structures are kept on tapes.Information in a Device Directory q File Name q File Type q Address or Location q Current Length q Maximum Length q Date created, Date last accessed (for archival), Date last updated (for dump) q Owner ID (who pays), Protection information n Also on a per file, per process basis q Current position - read/write position q usage countOperations Performed on Directory q Search for a file q Create a file q Delete a file q List a directory q Rename a file q Traverse the filesystemLogical Directory Organization -- Goals n Efficiency - locating a file quickly n Naming - convenient to users n Two users can have the same name for different files. n The same file can have several different names. n Grouping n Logical grouping of files by properties (e.g. all Python programs, all games, all pictures…)Single Level Directory n A single directory for all users n Naming Problem and Grouping Problem q As the number of files increases, difficult to remember unique names q As the number of users increase, users must have unique names.Two Level Directory n Introduced to remove naming problem between users q First Level contains list of user directories q Second Level contains user files q Need to specify Path name q Can have same file names for different users. q System files kept in separate directory or Level 1. q Efficient searchingTwo Level DirectoryTree structured DirectoriesTree Structured Directories n Arbitrary depth of directories n Leaf nodes are files, interior nodes are directories. n Efficient Searching n Grouping Capability n Current Directory (working directory) n cd /spell/mail/prog, cd .. n dir, ls n MS-DOS uses a tree structured directoryTree Structured Directories q Absolute or relative path name q Absolute from root q Relative paths from current working directory pointer. q Creating a new file is done in current directory q Creating a new subdirectory is done in current directory, e.g. mkdir <dir-name> q Delete a file , e.g. rm file-name q Deletion of directory n Option 1 : Only delete if directory is empty n Option 2: delete all files and subdirectories under directoryAcyclic Graph DirectoriesAcyclic Graph Directories n Acyclic graphs allow sharing n Implementation by links n Links are pointers to other files or subdirectories n Symbolic links or relative path name q Directory entry is marked as a link and name of real file/directory is given. Need to resolve link to locate file. n Implementation by shared files n Duplicate information in sharing directories n Original and copy indistinguishable. n Need to maintain consistency if one of them is modified.Acyclic Graph Directories q Naming : File may have multiple absolute path names n Two different names for the same file q Traversal q ensure that shared data structures are traversed only once. q Deletion n Removing file when someone deletes it may leave dangling pointers. n Preserve file until all references to it are deleted q Keep a list of all references to a file or q Keep a count of


View Full Document

UCI ICS 143 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?