DOC PREVIEW
Pitt CS 1550 - File Systems

This preview shows page 1-2-3-4-26-27-28-54-55-56-57 out of 57 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Chapter 6: File SystemsFile systemsLong-term information storageNaming filesTypical file extensionsFile structuresFile typesAccessing a fileFile attributesFile operationsUsing file system callsUsing file system calls, continuedMemory-mapped filesMore on memory-mapped filesDirectoriesSingle-level directory systemsTwo-level directory systemHierarchical directory systemUnix directory treeOperations on directoriesFile system implementation issuesCarving up the diskContiguous allocation for file blocksContiguous allocationLinked allocationFinding blocks with linked allocationLinked allocation using a RAM-based tableUsing a block index for allocationFinding blocks with indexed allocationLarger files with indexed allocationTwo-level indexed allocationBlock allocation with extentsManaging free space: bit vectorManaging free space: linked listIssues with free space managementWhat’s in a directory?Directory structureHandling long file names in a directorySharing filesSolution: use linksManaging disk spaceDisk quotasBacking up a file systemBitmaps used in a file system dumpChecking the file system for consistencyFile system cacheFile block cache data structuresGrouping data on diskLog-structured file systemsUnix Fast File System indexing schemeMore on Unix FFSDirectories in FFSCD-ROM file systemDirectory entry in MS-DOSMS-DOS File Allocation TableWindows 98 directory entry & file nameStoring a long name in Windows 98Chapter 6: File SystemsChapter 62CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)File systemsFilesDirectories & namingFile system implementationExample file systemsChapter 63CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Long-term information storageMust store large amounts of dataGigabytes -> terabytes -> petabytesStored information must survive the termination of the process using itLifetime can be seconds to yearsMust have some way of finding it!Multiple processes must be able to access the information concurrentlyChapter 64CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Naming filesImportant to be able to find files after they’re createdEvery file has at least one nameName can beHuman-accessible: “foo.c”, “my photo”, “Go Panthers!”, “Go Banana Slugs!”Machine-usable: 4502, 33481Case may or may not matterDepends on the file systemName may include information about the file’s contentsCertainly does for the user (the name should make it easy to figure out what’s in it!)Computer may use part of the name to determine the file typeChapter 65CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Typical file extensionsChapter 66CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)File structuresSequence of bytes Sequence of records1 byte1 record12A 101 111sab wm cm avg ejw sab elm brS02 F01 W02TreeChapter 67CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)File typesExecutablefileArchiveChapter 68CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Accessing a fileSequential accessRead all bytes/records from the beginningCannot jump aroundMay rewind or back up, howeverConvenient when medium was magnetic tapeOften useful when whole file is neededRandom accessBytes (or records) read in any orderEssential for database systemsRead can be …Move file marker (seek), then read or …Read and then move file markerChapter 69CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)File attributesChapter 610CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)File operationsCreate: make a new fileDelete: remove an existing fileOpen: prepare a file to be accessedClose: indicate that a file is no longer being accessedRead: get data from a fileWrite: put data to a fileAppend: like write, but only at the end of the fileSeek: move the “current” pointer elsewhere in the fileGet attributes: retrieve attribute informationSet attributes: modify attribute informationRename: change a file’s nameChapter 611CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Using file system callsChapter 612CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Using file system calls, continuedChapter 613CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Memory-mapped filesSegmented process before mapping files into its address spaceProcess after mapping Existing file abc into one segment Creating new segment for xyzProgramtextDataBefore mappingProgramtextDataAfter mappingabcxyzChapter 614CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)More on memory-mapped filesMemory-mapped files are a convenient abstractionExample: string search in a large file can be done just as with memory!Let the OS do the buffering (reads & writes) in the virtual memory systemSome issues come up…How long is the file?Easy if read-onlyDifficult if writes allowed: what if a write is past the end of file?What happens if the file is shared: when do changes appear to other processes?When are writes flushed out to disk?Clearly, easier to memory map read-only files…Chapter 615CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)DirectoriesNaming is nice, but limitedHumans like to group things together for convenienceFile systems allow this to be done with directories (sometimes called folders)Grouping makes it easier toFind files in the first place: remember the enclosing directories for the fileLocate related files (or just determine which files are related)Chapter 616CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Single-level directory systemsOne directory in the file systemExample directoryContains 4 files (foo, bar, baz, blah)owned by 3 different people: A, B, and C (owners shown in red)Problem: what if user B wants to create a file called foo?RootdirectoryAfooAbarBbazCblahChapter 617CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)Two-level directory systemSolves naming problem: each user has her own directoryMultiple users can use the same file


View Full Document

Pitt CS 1550 - File Systems

Download File Systems
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

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