Operating Systems Lecture #5: File Management Written by David Goodwin based on the lecture series of Dr. Dayou Li and the book Understanding Operating Systems 4thed. by I.M.Flynn and A.McIver McHoes (2006) Department of Computer Science and Technology, University of Bedfordshire. Operating Systems, 2013 25th February 2013 Outline Lecture #5 File Management David Goodwin 1 Introduction University of Bedfordshire 2 Interaction with the file manager Introduction Interaction with the file manager 3 Files Files Physical storage 4 Physical storage allocation allocation Directories 5 Directories File system Access 6 File system Data compression summary 7 Access 8 Data compression 9 summary Operating Systems 46 Lecture #5 File Management David Goodwin University of Bedfordshire Introduction 3 Interaction with the file manager Introduction Files Physical storage allocation Directories File system Access Data compression summary Operating Systems 46 Introduction Lecture #5 File Management David Goodwin University of Bedfordshire Introduction 4 Responsibilities of the file manager Interaction with the file manager 1 Keep track of where each file is stored Files 2 Use a policy that will determine where and how the files will Physical storage be stored, making sure to efficiently use the available storage allocation space and provide efficient access to the files. Directories 3 Allocate each file when a user has been cleared for access to File system it, and then record its use. Access 4 Deallocate the file when the file is to be returned to storage, Data compression and communicate its availability to others who may be summary waiting for it. Operating Systems 46 Definitions Lecture #5 File Management field is a group of related bytes that can be identified by David Goodwin University of the user with a name, type, and size. Bedfordshire record is a group of related fields. Introduction 5 file is a group of related records that contains Interaction with the file manager information to be used by specific application Files programs to generate reports. This type of file Physical storage allocation contains data and is sometimes called a “flat file” Directories because it has no connections to other file; unlike File system databases it has no dimensionality. Access database appear to be a type of file, but databases are more Data compression complex. They are groups of related files that are summary interconnected at various levels to give flexibility of access to the data stored. program files contain instructions. data files contain data. directories are listings of filenames and their attributes. Operating Systems 46 Lecture #5 File Management David Goodwin University of Bedfordshire Introduction Interaction with the 6 Interaction with the file manager Files Physical storage file manager allocation Directories File system Access Data compression summary Operating Systems 46 Interacting with the File Manager Lecture #5 File Management David Goodwin User communicates via commands, either embedded in user's University of Bedfordshire program or submitted interactively by user. embedded commands are: Introduction OPEN / CLOSE - pertain to the availability of a file for the Interaction with the 7 file manager program invoking it. Files READ / WRITE - are I/O commands. MODIFY - specialised WRITE command for existing data Physical storage allocation files, allows for appending records or for rewriting selected Directories records in their origional place in the file. File system interactive commands are: Access CREATE / DELETE - deal with the system's knowledge of Data compression the file (some systems have the first instance of SAVE command, others OPEN NEW, OPEN::: FOR OUTPUT. summary RENAME - allows users to change the name of an existing file. COPY - lets users make duplicate copies of existing files. These commands (and many more) are designed to be simple to make them device independent. Operating Systems 46 Interaction with the File Manager Lecture #5 File Management David Goodwin University of Bedfordshire Introduction Interaction with the 8 Example - READ instruction: file manager 1 Move the read/write heads of the cylinder where the record is Files to be found. Physical storage allocation 2 Wait for the rotational delay until the sector containing the Directories desired record passes under the read/write head. File system 3 Activate the appropriate read/write head and read the record. Access 4 Transfer the record to main memory. Data compression 5 Send a flag to indicate that the device is free to satisfy summary another request. Operating Systems 46 Volume Configuration Lecture #5 File Management David Goodwin Each storage unit is considered a volume. University of Bedfordshire Each volume in the system is given a name and other Introduction descriptive information contained on an easy-to-access place Interaction with the 9 (innermaost part of CD, first sector of outermost track of a file manager disk pack). Volume Descriptor: Files Creation date - date when volume was created. Physical storage allocation Pointer to diectory area - indicates first sector where directory Directories is stored. File system Pointer to file area - indicates first sector where file is stored. Access File system code - used to detect volumes with incorrect Data compression formats. summary Volume name - user-allocated name. The Master file directory (MFD) is stored immediately after the volume descriptor lists the names and characteristics of every file contained in that volume. Operating Systems 46 Lecture #5 File Management David Goodwin University of Bedfordshire Introduction Interaction with the file manager Files Files 10 Physical storage allocation Directories File system Access Data compression summary Operating Systems 46 File attributes Lecture #5 File Management David Goodwin University of Bedfordshire Introduction Information about files is kept in the directory structure, Interaction with the which is also maintained on the disk. file manager Name { only information kept in human-readable form. Files 11 Identifier { non-human readable unique tag (usually a Physical storage allocation number). Directories Type { needed for systems that support different types. File system Location { pointer to file location on device. Access Size { current file size. Data compression Protection { controls who can do reading, writing, executing. summary Time, date, and user identification { data for protection, security, and usage monitoring. Operating Systems 46 File operations Lecture #5 File Management David Goodwin University of Bedfordshire Create Introduction Interaction with the Write file manager Read Files 12 Physical storage Reposition within file { file seek allocation Directories Delete File system Truncate Access Open(Fi) { search the directory structure on disk for entry Data compression F , and move the content of entry to memory. summary i Close (Fi) { move the content of entry Fi in memory to directory structure on disk. Operating Systems 46 File types Lecture #5 File Management David Goodwin University of Bedfordshire Introduction OS recognises and supports file types Interaction with the helps prevent user mistakes file manager convenient by automatically doing various jobs after a Files 13 command Physical storage allocation must define every file type allowed and difficult to create new Directories file types File system Commonly implemented by using an extension name Access Data compression Creator attribute used to identify the file type and invoke the summary creator application program Internal file structure can be indicated by file types Operating Systems 46 File Types Lecture #5 File Management David Goodwin Two components are common to most filenames: University of Bedfordshire 1 relative filename Introduction 2 extension (called a suffix in UNIX/Linux) Interaction with the A complete filename identifies a file’s absolute filename; file manager being the long name that includes path information. Files 14 Physical storage there are restrictions on filename with each operating system: allocation MS-DOS - allows names from one to eight alphanumeric Directories characters, but without spaces File system most modern operating systems do not have restrictions on Access filenames. Data compression summary An extension usually 2 or 3 characters long and is separated by a period (.). The purpose is to identify the file type or its contents. NOTE: some extensions are associated with more than one application Operating Systems 46 File types { name and extension Lecture #5 File Management David Goodwin University of Bedfordshire Introduction Interaction with the file manager Files 15 Physical storage allocation Directories File system Access Data compression summary Operating Systems 46 Access methods Lecture #5 File Management David Goodwin University of Bedfordshire Introduction Sequential access Interaction with the file manager Easiest Files 16 File searched from its beginning until record is found Physical storage allocation Direct (relative/random) access Directories Only on direct access storage devices File system Records identified by their relative address to the beginning Access of the file Data compression Indexed access summary Combines the best of sequential and direct access Operating Systems 46 Access methods - direct access example Lecture #5 File Management David Goodwin University of Bedfordshire Records identified by logical address, them relative to the Introduction beginning of the file. Interaction with the file manager User identifies a field
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages46 Page
-
File Size-