2 What is a file?File is term applied to anything held on secondary storageIncludes programs (source and executable) text files such as word documents, spreadsheet files, database files etc.
3 File namingMS DOS format is generally up to eight character name followed by a dot and then a three character extension.Example Letter1.doc , hello.exe , stock.datLinux/Unix file naming is more flexible can have something like myfile.example.doc normally .bin files are equivelent to exe files in windows.
4 Objectives of O.S. Hide complexity of how files are saved from user Problems with physical addressing, perform error checking, i/o tasks to storage.Develop file management strategiesExplore files and foldersCreate, name, copy, move, and delete foldersName, copy, move, and delete filesWork with compressed files
5 Organizing Files and Folders A file, or document, is a collection of data that has a name and is stored in a computerYou organize files by storing them in foldersDisks contain folders that hold documents, or filesFloppy disksZip disksCompact Discs (CDs)Hard DisksRemovable disks are inserted into a drive
7 Understanding the Need for Organizing Files and Folders Windows organizes the folders and files in a hierarchy, or file systemWindows stores folders and important files that it needs when you turn on the computer in the root directoryFolders stored within other folders are called subfolders
8 Understanding the Need for Organizing Files and Folders
9 Directories A directory is a logical grouping of files All modern operating systems have a directory structureWhy security and housekeeping on systemExample on Linux system only root user will have access to sbin directory.
11 File Management System Provides a logical view for the user and hides the physical implementationWhere a file is located and how it is stored on disk is role of OSManages directory structures and space allocation for each I/O devicePermits manipulation of data within a fileRequests data transfers from I/O device driversFile security and protection of file integrity
12 File Management and I/O Functions Separation between the two allowsI/O devices can change while keeping the file system the sameRedirecting of data is simple
14 File StorageOver time file sizes change this can be a problem for OS. As files reduce get deleted, compressed etc spaces develop on disk – fragmentation.OS provides fixed size blocks for storing data, called cluster.Problem is clusters are often not sequential.
15 File Access Methods Sequential Access Random Access Indexed Access File is read in sequence from beginning to endMajority of all filesProgram source and binary filesRandom AccessAssumes file is made up of fixed length logical recordsHashing is a common method used to calculate the location of an internal logical recordIndexed AccessAdditional means for accessing and viewing records in a fileKey indexes
17 Contiguous Storage Allocation Assign blocks (all in a row) to hold the fileAccess is simple for both sequential and random methodsDisadvantagesSpace must be large enoughHave to take into account file growthMay need to be moved if it outgrows its spaceFragmentation of diskAllocation strategies to minimize fragmentationFirst-fit, best-fitEventually disk becomes fragmented
19 Linked Allocation Non-contiguous Each block contains a link to the next physical blockVariant – links in both directionsAdvantagesno fragmentationAdding to a file is easyDisadvantagesNot usable for random accessAdditional disk head searchingOverhead in storing the pointersRecovery of a defective block is difficult
21 MS-DOS FAT File Allocation Table (FAT) Table contains the first block of each file on the disk or disk partitionSuccessive blocks contain a link to the next blockRequires a tremendous amount of spaceFile integrity can be easily compromised
22 MS-DOS FAT Linked Allocation and File Allocation Table FAT table with file name and address of first cluster
23 Indexed AllocationIndex blocks for indexed allocation of linked files shown in MS-DOS FAT example
24 Indexed Allocation Non-contiguous All link pointers are stored together in a single block called the index blockOne index block per fileAdvantagesNo fragmentationCan be used for random accessDisadvantageSlower due to additional access of the index blockAdditional disk head searchingRecovery of a defective block is difficult
25 Unix i-nodes Indexed file allocation Index block contains Advantages File attributes10 direct blocks1 single indirect1 double indirect1 triple indirectAdvantagesFast for small blocksCan accommodate very large files – 100’s of gigabytes
27 Windows 2000 - NTFS Dynamically sized volumes Volumes may be a fraction of a disk or span many disksMaster File Table (MFT) of 1kb records1st 16 records are attributes of the MFT ie system files used to manage the volumeEach file has an MFT entry
28 NTFS Volume LayoutMtf table can store actual data or a list of clusters where data for file is stored. Where mtf stores file it must be small ie under 700bytes.
29 Other Secondary Storage Allocation Tape AllocationNot practical to reallocate space in the middle of the tapeFiles that grow must be re-writtenFiles are stored contiguously whenever possibleCD-ROM and DVD-ROM AllocationBlock system described in Chapter 10Eight levels of subdirectoriesDirectory format similar to MS-DOS although extensions permit longer filenames and deeper subdirectory levelsFiles can be stored non-contiguously
30 Directory StructureProvides a means of organization so that files can be located easily and efficientlyHide the physical devices from the logical view of the filesPartitionsIndependent subsections of a deviceVolumeDirectory structure for a particular partitionNeeds to be mounted to be incorporated into the overall file system structureContain file attributes
31 Tree-Structure Directory Hierarchical with a top-level root directory from which all other directories stemAll directories and files have namesSeparatorUsed to indicate subdirectories and files located in a directory/ UNIX\ DOS, WindowsPathnameAbsolute – full pathname starting from the root directoryRelative – pathname is created starting from the current directorySearch PathsDirectory locations that the operating system uses to locate files
34 RAID Redundant Array of Independent Disks Redundant Array of Inexpensive Disks6 levels in common useNot a hierarchySet of physical disks viewed as single logical drive by O/SData distributed across physical drivesCan use redundant capacity to store parity information
35 RAID 0 No redundancy Data striped across all disks Round Robin stripingIncrease speedMultiple data requests probably not on same diskDisks seek in parallelA set of data is likely to be striped across multiple disks
36 RAID 1 Mirrored Disks Data is striped across disks 2 copies of each stripe on separate disksRead from eitherWrite to bothRecovery is simpleSwap faulty disk & re-mirrorNo down timeExpensive
37 RAID 2 Disks are synchronized Very small stripes Often single byte/wordError correction calculated across corresponding bits on disksMultiple parity disks store Hamming code error correction in corresponding positionsLots of redundancyExpensiveNot used
38 RAID 3Similar to RAID 2Only one redundant disk, no matter how large the arraySimple parity bit for each set of corresponding bitsData on failed drive can be reconstructed from surviving data and parity infoVery high transfer rates
39 RAID 4 Each disk operates independently Good for high I/O request rate Large stripesBit by bit parity calculated across stripes on each diskParity stored on parity disk
40 RAID 5 Like RAID 4 Parity striped across all disks Round robin allocation for parity stripeAvoids RAID 4 bottleneck at parity diskCommonly used in network serversN.B. DOES NOT MEAN 5 DISKS!!!!!
41 RAID 6 Two parity calculations Stored in separate blocks on different disksUser requirement of N disks needs N+2High data availabilityThree disks need to fail for data lossSignificant write penalty