Rose-Hulman CSSE 332 - File Management (31 pages)

Previewing pages 1, 2, 14, 15, 30, 31 of 31 page document View the full content.
View Full Document

File Management



Previewing pages 1, 2, 14, 15, 30, 31 of actual document.

View the full content.
View Full Document
View Full Document

File Management

54 views


Pages:
31
School:
Rose-Hulman Institute of Technology
Course:
Csse 332 - Operating Systems
Unformatted text preview:

Why a file system Why a file system There is a general need for long term and shared data storage need to store large amount of information persistent storage outlives process and system reboots concurrent sharing of information Files meet these requirements The file manager or file system within the OS Set of system software proving services to users and applications in use of files Files are accessed through file management system 2 Concept of a file A named collection of related data stored on secondary storage File name may encode the file type file extensions in UNIX and Windows Abstraction presented to the user Common examples of File types Regular files directories Executable files special files block and character Archives 3 File structure logical None sequence of words bytes Simple record structure Lines Fixed length Variable length Complex Structures Formatted document multi media documents Who decides Operating system Application DBMS 4 File attributes Name only information kept in human readable form 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 monitoring Information about files are kept in the directory structure which is maintained on the disk 5 File operations create write read reposition within file file seek delete truncate open file i search the directory structure on disk for entry file i and move the content of entry to memory close file i move the content of entry file i from memory to directory structure on disk 6 Examples of file types File Type Executable Object Source code Usual extension exe com bin or none obj o Functiion ready to run machinelanguage program complied machine language not linked source code in various languages commands to the command interpreter textual data documents Batch c p pas 177 asm a bat sh Text txt doc Word processor wp tex rrf etc Library lib a various word processor formats libraries of routines Print or view ps dvi gif ASCII or binary file Archive arc zip tar rar related files grouped into one file sometimes compressed 7 Access methods for file data Sequential Access most common read next write next rewrite reset no read after last write Direct Access n relative block number on disk read n write n rewrite n position to n read next write next 8 Directory structure Directory contains a collection of nodes containing information about all files Both the directory structure and the files reside on disk Backups of these two structures are kept on tapes Directory Files F1 F2 F3 F4 Fn 9 Information per file in a directory Name Type Address Current length Maximum length Date last accessed for archival Date last updated for dump Owner ID who pays Protection information discuss later 10 Directory operations Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system 11 Organize the directory logically Efficiency locating a file quickly Naming convenient to users Two users can have same name for different files The same file can have several different names Grouping logical grouping of files by properties e g all Java programs all games 12 Single level directory A single directory for all users Naming problem Grouping problem 13 Two level directory Separate directory for each user Path name Can have the same file name for different user Efficient searching No grouping capability 14 Tree structured directories 15 Tree structured directories Efficient searching Grouping Capability Absolute or relative path name Current directory working directory cd Users faculty defoe Public type echo Creating a new file is done in current directory Creating a new subdirectory is done in current directory 16 Protection File owner creator should be able to control what can be done by whom Types of access Read Write Execute Append Delete List 17 Access lists and groups Mode of access read write execute Three classes of users a owner access 7 b groups access 6 c public access 1 RWX 111 RWX 110 RWX 001 Ask manager to create a group unique name say G and add some users to the group For particular file or subdirectory define an appropriate access owner chmod Attach a group to a file chgrp G group 761 public game game 18 Filesystem structure Disk divided into one or more partitions independent file system on each partition Sector 0 contains the Master Boot Record MBR MBR contains partition table one partition marked as active boot block first block of active partition BIOS reads and executes MBR which reads boot block and executes it program in boot block loads OS and runs it Often file system contains superblock which contains key file system parameters 19 Example disk and filesystem layout Partition Table MBR partition 1 partition 2 active boot block super block free space management partition 3 inode list root dir files dirs 20 File allocation on disk Disk is divided into blocks or sectors Files are stored on secondary storage in blocks or sectors Blocks are the unit of I O transfer with secondary storage on LINUX and UNIX sectors on Windows Blocks can be of fixed length or variable length Need file allocation table FAT to keep track of files on disk Each file has a FAT entry 21 File allocation methods Keep track of which sectors blocks on the disk belong to which logical file directory Methods include Contiguous allocation Linked chained allocation Indexed allocation 22 Contiguous allocation Each file occupies a set of contiguous blocks on the disk Simple FAT entry only starting location block and length number of blocks are required Random access Wasteful of space external fragmentation may use compaction to fix Files cannot grow Pre allocation of blocks is required Maximum file size is known in advance 23 Contiguous allocation What happens if file F requires 6 blocks 24 Contiguous allocation 25 Linked allocation Each file is a linked list of disk blocks blocks may be scattered anywhere on the disk no external fragmentation Dynamic allocation of blocks allocate blocks as needed link together e g file starts at block 9 File allocation table entry is simple only starting location block is required length or end block can be given Very inefficient with random access files 26 Linked allocation example pointer block 27 Another linked allocation example 28 Example after consolidating file 29 Indexed allocation Brings


View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view File Management 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 File Management 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?