Transcription of Operating Systems - Lecture #5: File Management
1 Operating SystemsLecture #5:File ManagementWritten by David Goodwinbased on the Lecture series of Dr. Dayou Liand the bookUnderstanding Operating and McHoes(2006)Department of Computer Science and Technology,University of Systems , 201325thFebruary 201346 Lecture #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroductionInteraction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsOutline1 Introduction2 Interaction with the file manager3 Files4 Physical storage allocation5 Directories6 File system7 Access8 Data compression9summary46 Lecture #5 FileManagementDavid GoodwinUniversity ofBedfordshire3 IntroductionInteraction with thefile managerFilesPhysical storageallocationDirectoriesFile
2 SystemAccessData compressionsummaryOperating SystemsIntroduction46 Lecture #5 FileManagementDavid GoodwinUniversity ofBedfordshire4 IntroductionInteraction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsIntroduction Responsibilities of the file manager1 Keep track of where each file is stored2 Use a policy that will determine where and how the files willbe stored, making sure to efficiently use the available storagespace and provide efficient access to the each file when a user has been cleared for access toit, and then record its the file when the file is to be returned to storage.
3 And communicate its availability to others who may bewaiting for #5 FileManagementDavid GoodwinUniversity ofBedfordshire5 IntroductionInteraction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsDefinitionsfieldis a group of related bytes that can be identified bythe user with a name, type, and a group of related a group of related records that containsinformation to be used by specific applicationprograms to generate reports. This type of filecontains data and is sometimes called a flat file because it has no connections to other file; unlikedatabases it has no to be a type of file, but databases are morecomplex.
4 They are groups of related files that areinterconnected at various levels to give flexibility ofaccess to the data filescontain filescontain listings of filenames and their #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroduction6 Interaction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsInteraction with thefile manager46 Lecture #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroduction7 Interaction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsInteracting with the File Manager User communicates via commands, either embedded in user sprogram or submitted interactively by user.
5 Embedded commands are: OPEN / CLOSE - pertain to the availability of a file for theprogram invoking it. READ / WRITE - are I/O commands. MODIFY - specialised WRITE command for existing datafiles, allows for appending records or for rewriting selectedrecords in their origional place in the file. interactive commands are: CREATE / DELETE - deal with the system s knowledge ofthe file (some Systems have the first instance of SAVE command, others OPEN NEW, OUTPUT. RENAME - allows users to change the name of an existingfile. COPY - lets users make duplicate copies of existing files.)
6 These commands (and many more) are designed to be simpleto make themdevice #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroduction8 Interaction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsInteraction with the File Manager Example - READ instruction:1 Move the read/write heads of the cylinder where the record isto be for the rotational delay until the sector containing thedesired record passes under the read/write the appropriate read/write head and read the the record to main a flag to indicate that the device is free to satisfyanother #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroduction9 Interaction with thefile managerFilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsVolume Configuration Each storage unit is
7 Considered avolume. Each volume in the system is given a name and otherdescriptive information contained on an easy-to-access place(innermaost part of CD, first sector of outermost track of adisk pack). Volume Descriptor: Creation date - date when volume was created. Pointer to diectory area - indicates first sector where directoryis stored. Pointer to file area - indicates first sector where file is stored. File system code - used to detect volumes with incorrectformats. Volume name - user-allocated name. TheMaster file directory (MFD)is stored immediatelyafter the volume descriptor lists the names and characteristics of every file contained inthat #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroductionInteraction with thefile manager10 FilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsFiles46 Lecture #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroductionInteraction with thefile manager11 FilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsFile
8 Attributes Information about files is kept in the directory structure,which is also maintained on the disk. Name only information kept in human-readable form. Identifier non-human readable unique tag (usually anumber). 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, and user identification data for protection,security, and usage #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroductionInteraction with thefile manager12 FilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsFile operations Create Write Read Reposition within file file seek Delete Truncate Open(Fi) search the directory structure on disk for entryFi, and move the content of entry to memory.
9 Close (Fi) move the content of entryFiin memory todirectory structure on #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroductionInteraction with thefile manager13 FilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsFile types OS recognises and supports file types helps prevent user mistakes convenient by automatically doing various jobs after acommand must define every file type allowed and difficult to create newfile types Commonly implemented by using an extension name Creator attribute
10 Used to identify the file type and invoke thecreator application program Internal file structure can be indicated by file types46 Lecture #5 FileManagementDavid GoodwinUniversity ofBedfordshireIntroductionInteraction with thefile manager14 FilesPhysical storageallocationDirectoriesFile systemAccessData compressionsummaryOperating SystemsFile Types Two components are common to most filenames:1relative filename2extension (called a suffix in UNIX/Linux) A complete filename identifies a file sabsolute filename;being the long name that includes path information.