ICS 143 - Principles of Operating SystemsOutlineFile ConceptFile StructureFile AttributesFile types - name.extensionFile OperationsDirectory StructureInformation in a Device DirectoryOperations Performed on DirectoryLogical Directory Organization -- GoalsSingle Level DirectoryTwo Level DirectorySlide 14Tree structured DirectoriesTree Structured DirectoriesSlide 17Acyclic Graph DirectoriesSlide 19Slide 20General Graph DirectoriesGeneral Graph Directories (cont.)Access MethodsProtectionAccess lists and groupsFile-System ImplementationFile-System StructureFile System MountingAllocation of Disk SpaceContiguous AllocationSlide 34Linked AllocationSlide 36Slide 37Linked Allocation (cont.)File Allocation Table (FAT)FAT File SystemsDisk DefragmentationIndexed AllocationSlide 43Indexed Allocation (cont.)Indexed Allocation - MappingIndexed File - Linked SchemeIndexed Allocation - Multilevel indexCombined Scheme: UNIX InodeWhat is an inode?Information in the inodeDirectoriesFree Space ManagementSlide 53Slide 54Directory ImplementationEfficiency and PerformanceRecoveryICS 143 - Principles of Operating SystemsLectures 14 and 15 - FileSystem Interface and ImplementationProf. Dmitri V. Kalashnikovdvk (@) ics.uci.eduSlides © Prof. Nalini Venkatasubramanian.OutlineFile Concept and StructureDirectory StructuresFile OrganizationsAccess MethodsProtectionFile ConceptContiguous logical address spaceOS abstracts from the physical properties of its storage device to define a logical storage unit called file.PersistentOS maps files to physical devices.TypesDatanumeric, character, binaryProgramsource, object (load image)DocumentsFile StructureNone - sequence of words/bytesSimple record structureLinesFixed LengthVariable LengthComplex StructuresFormatted documentRelocatable Load FileCan simulate last two with first method by inserting appropriate control charactersWho decides Operating SystemProgramFile AttributesName symbolic file-name, only information in human-readable formIdentifierUnique tag that identifies file within filesystem; non-human readable nameType - for systems that support multiple typesLocation - pointer to a device and to file location on deviceSize - current file size, maximal possible sizeProtection - controls who can read, write, executeTime, Date and user identification data for protection, security and usage monitoringInformation about files are kept in the directory structure, maintained on diskFile types - name.extensionFile 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 OperationsA file is an abstract data type. It can be defined by operations:Create a fileWrite a fileRead a fileReposition within file - file seekDelete a fileTruncate a fileOpen(Fi)search the directory structure on disk for entry Fi, and move the content of entry to memory. Close(Fi)move the content of entry Fi in memory to directory structure on disk.Directory StructureNumber of files on a system can be extensiveBreak file systems into partitions ( treated as a separate storage device)Hold information about files within partitions.Device Directory: A collection of nodes containing information about all files on a partition.Both the directory structure and files reside on disk.Backups of these two structures are kept on tapes.Information in a Device DirectoryFile NameFile TypeAddress or LocationCurrent LengthMaximum LengthDate created, Date last accessed (for archival), Date last updated (for dump)Owner ID (who pays), Protection informationAlso on a per file, per process basisCurrent position - read/write positionusage countOperations Performed on DirectorySearch for a fileCreate a fileDelete a fileList a directoryRename a fileTraverse the filesystemLogical Directory Organization -- GoalsEfficiency - locating a file quicklyNaming - convenient to usersTwo users can have the same name for different files.The same file can have several different names.GroupingLogical grouping of files by properties (e.g. all Python programs, all games, all pictures…)Single Level DirectoryA single directory for all usersNaming Problem and Grouping ProblemAs the number of files increases, difficult to remember unique namesAs the number of users increase, users must have unique names.Two Level DirectoryIntroduced to remove naming problem between usersFirst Level contains list of user directoriesSecond Level contains user filesNeed to specify Path nameCan have same file names for different users.System files kept in separate directory or Level 1.Efficient searchingTwo Level DirectoryTree structured DirectoriesTree Structured DirectoriesArbitrary depth of directoriesLeaf nodes are files, interior nodes are directories.Efficient SearchingGrouping CapabilityCurrent Directory (working directory)cd /spell/mail/prog, cd .. dir, lsMS-DOS uses a tree structured directoryTree Structured DirectoriesAbsolute or relative path nameAbsolute from rootRelative paths from current working directory pointer.Creating a new file is done in current directoryCreating a new subdirectory is done in current directory, e.g. mkdir <dir-name>Delete a file , e.g. rm file-nameDeletion of directory Option 1 : Only delete if directory is emptyOption 2: delete all files and subdirectories under directoryAcyclic Graph DirectoriesAcyclic Graph DirectoriesAcyclic graphs allow sharingImplementation by linksLinks are pointers to other files or subdirectoriesSymbolic links or relative path name Directory entry is marked as a link and name of real file/directory is given. Need to resolve link to locate file.Implementation by shared filesDuplicate information in sharing directoriesOriginal and copy indistinguishable.Need to maintain consistency if one of them is modified.Acyclic Graph DirectoriesNaming : File may have multiple absolute path namesTwo
View Full Document