operating systems {week 16a }

Download Operating Systems {week  16a }

Post on 24-Feb-2016




0 download

Embed Size (px)


Rensselaer Polytechnic Institute CSC 432 Operating Systems David Goldschmidt, Ph.D. Operating Systems {week 16a }. Hierarchical storage architecture. very fast. very small. volatile. managed as part of the filesystem. non-volatile. very slow. very large. File management. - PowerPoint PPT Presentation


Chapter 1: Information Technology

Operating Systems{week 16a}Rensselaer Polytechnic InstituteCSC 432 Operating SystemsDavid Goldschmidt, Ph.D.Hierarchical storage architecture

very smallvery largevery fastvery slowvolatilenon-volatilemanaged aspart of thefilesystemFile managementA File Management System is a set of OS services that supports files and directories for user applications, OS programs, etc.Data should be organized andavailable in a convenient andefficient mannerFiles are the basicbuilding blocks

FilesA file is an abstraction that represents user data, OS data, an executable, a device, etc.A file is simply a sequence of bytes

Actual storage location (via network?) andformat are transparent to usersStorage scheme on disk is also transparentTypically involves cylinders, tracks, sectors, etc.

File attributesFile attributes include:Human-readable symbolic nameType (e.g. executable, directory, text, PDF, etc.)Logical location (i.e. containing directory or path)Physical location on diskSize (in bytes)Protection or security (i.e. permissions)Timestamps (created, last modified, last accessed)

PathnamesThe pathname (or just path) of a file specifies the sequence of directoriesone must traverse to locatethe fileAn absolute path startsat the root nodeA relative path startsanywhere

LinksA link provides a shortcut to a file and may circumvent the given directory hierarchyA hard link in Unix isindistinguishable fromthe original fileA symbolic link in Unixis merely a shortcutA Windows shortcut is just a symbolic link

Creating and accessing filesFile creation requires space allocationOpening a file returns a handle or file descriptor Read and write operationsuse the handle and anoffset (or file pointer)The close operation simplydeletes the handle anddeallocates any memoryDeleting filesDeleting a file deallocates all disk spacemarked as in use by the fileBut likely does not erase file contentsDeleted files are recoverable until the disk space is used for (and overwritten by) other file(s)The delete operation also removes the corresponding entry in the containing directoryAccess methodsAn access method describes the mannerand mechanisms by which a process accesses the data in a file

Two common access methods:Sequential access (open, read, write, close)Random access (open, read, write, seek, close)Contiguous disk space allocation (i)In a contiguous disk space allocation scheme, files are allocated to contiguous blocks of disk space

Contiguous disk space allocation (ii)Four files allocated contiguously to disk:

File B outgrows its space and is reallocated:

File D outgrows its space and is reallocated:


Clustered disk space allocation (i)In a clustered disk space allocation scheme, files are allocated to clusters of disk space on an as needed basisClustered disk space allocation (ii)Four files allocated contiguously to disk:

File B outgrows its space, so one or more new clusters are allocated:

File D outgrows its space, so one or more new clusters are allocated:AAABBCCCDAAABBCCCDBBAAABBCCCDBBDClustered disk space allocation (iii)File accesses may cross cluster boundaries,causing slower response times

Clustered disk space allocation (iv)Using a linked approach,each cluster has apointer to the next cluster

Using an indexed approach, a singletable maintains pointers to eachindividual clusterManaging free spaceManaging free blocks (or free clusters) may follow the same scheme as for a single fileLinked schemeIndexed approach

Bitmapped approach:A bitmap is maintained in memoryEach bit corresponds to a block or clusterA 0 indicates a free blockA 1 indicates the block is in use

File allocation table (i)A file allocation table (FAT) maps logical filesto their physical addresses on a diskA pure FAT would have an entryfor each sector (e.g. 512 bytes)To improve performance, clustersof contiguous sectors are usedClusters range from 4 to 64 sectors(e.g. 2,048 to 32,768 bytes)

File allocation table (ii)Microsoft FAT-32 filesystem maps to clustersMay require linked clusters to house entire FAT

Linux ext2 and ext3Linux uses indexed clusters

Unix inodes (i)In Unix, file information is stored in an index node (I-node), which contains:Mode and type of fileNumber of links to the fileFile owners userid and groupid Size of file (in bytes)Last access and last modified timesNumber of blocks allocated to the filePointers to the first twelve blocksPointers to three additional blocks of pointersUnix inodes (ii)inode12










single indirectinode1024

double indirectinode1024



triple indirect