Chapter 10: File-System InterfaceSlide 2Storage ManagementObjectivesFile ConceptSlide 6File AttributesFile OperationsTypical File OperationsSlide 10File Operations – The Process ItselfOpen File TablesOpen File Basic InformationOpen File LockingFile Locking Example – Java APIFile Locking Example – Java API (cont)File Types – Name, ExtensionSlide 18File StructureFile Structure – not recognizable formats…Internal File StructureSlide 22Slide 23Access MethodsSlide 25Slide 26Sequential-access FileSimulation of Sequential Access on a Direct-access FileExample of Index and Relative FilesSlide 30Slide 31End of Chapter 10.1Chapter 10: File-System InterfaceChapter 10: File-System Interface10.2Silberschatz, Galvin and Gagne ©2005Operating System ConceptsChapter 10: File-System InterfaceChapter 10: File-System InterfaceChapter 10.1File ConceptAccess MethodsChapter 10.2Directory StructureFile-System MountingFile SharingProtection10.3Silberschatz, Galvin and Gagne ©2005Operating System ConceptsStorage ManagementStorage ManagementNew block – Storage ManagementProcess / processor managementMemory management Storage managementDisk storage – the primary medium for primary, online storage.Contains files – collections of related items defined by the file creator.Normally grouped into directories for ease of use and reference.Organized in a variety of structures.Disk Access – sometimes character at a time; blocks at a time.Disk Access – sometimes access sequentially; sometimes randomly.Some file systems dedicated; some sharedSome transfer data asynchronously; others synchronously.Differ greatly in speed – many parameters as cited above.This chapter: the File System Interface.10.4Silberschatz, Galvin and Gagne ©2005Operating System ConceptsObjectivesObjectivesTo explain the function of file systemsTo describe the interfaces to file systemsTo discuss file-system design tradeoffs, including access methods, file sharing, file locking, and directory structuresTo explore file-system protection10.5Silberschatz, Galvin and Gagne ©2005Operating System ConceptsFile ConceptFile ConceptA File System consists of two parts:Files – storage of dataStored on a sequential or some kind of direct access storage device.Directory Structure – organizes the information about the files.Size, location, logical record length, block size, format, ownership, security, paths to files/directories,l etc.A file may be defined as a contiguous logical address space, which is mapped by the operating system onto some kind of physical devices.Almost all storage devices are non-volatileMagnetic tapesMagnetic disksOptical disks,Jump drivesCDs / DVDs ….Many more…10.6Silberschatz, Galvin and Gagne ©2005Operating System ConceptsFile ConceptFile ConceptTo a user, a file is the smallest allocation of logical secondary storage. All data is written to a ‘file.’Data may be numeric, alphabetic, alphanumeric, or binary.Can be free form (text) Can be rigidly formatted – records.Can be somewhere in between – variable length recordsBright Lights files overseas?Generally, a file is a sequence of bits, bytes, lines, or records whose meaning is interpreted by the creator of the file and how it is used. Files – data files – many forms and structuresI like to differentiate between a file’s organization and how it may be accessed.They are not the same, as we shall see.Files - program files – source programs, object files – understandable by the linker and executable files – ready for loader to bring into memory.These files, when created, contain relocation and linkage information that linkers and loaders need to create executables and/or to load the file for execution.Much of the data about programs and data files revolves simply as how they are used!10.7Silberschatz, Galvin and Gagne ©2005Operating System ConceptsFile AttributesFile AttributesName – This is the only information kept in human-readable formIs independent of the process and system that created it.But names often are constrained by the operational environment.NIHPOO……. Each positions often means something very important in a commercial (non-academic environment.)Identifier – unique tag (number) identifies file within file systemNIHP00; System Code IH; Source programs: ‘N’; subsystem ‘P’Programs within subsystem: 00, 01, ….Type – needed for systems that support different types.c, .java. .cpp, .exe, .dll, .dat, .wpd, .doc, etc. .xls, .css. ….And bringing up certain ‘processes’ to process these files … by type.Location – pointer to file location on deviceSize – current file size - generally in bytes or blocks, especially blocks.Protection – controls who can do reading, writing, executingYes! Read, write, execute, Time, date, and user identification – data for protection, security, and usage monitoring – Maybe date last accesses; OPR; security; Information about files like those mentioned above are kept in the directory structure, which is maintained on the diskNames: example: VTOC (Volume Table of Contents – IBM) or some general directory structure name…10.8Silberschatz, Galvin and Gagne ©2005Operating System ConceptsFile OperationsFile OperationsFile is an “abstract data type.”This means it has data which will be unique to its implementation (realization and use), andOperations that can be performed on the data – dependent upon how it is implemented.Let’s look at the six basic functions that can be performed on most files.10.9Silberschatz, Galvin and Gagne ©2005Operating System ConceptsTypical File OperationsTypical File OperationsCreate – Need to allocate spaceAdd an entry in the disk directory; load data onto the storage device.Write – “System call” supplies name of file and data to be written.A pointer usually needs to be available to point to the place where the next ‘item’ is to be written; pointer updated.Read – Another system call specifies file name, where in memory the read data is to be placed, and, using a read pointer, locates the data to be read.Pointer needs to be updated to point to the ‘next’ item to be read.Pointer for read and write is called a ‘current file-position
View Full Document