
OperatingSystemsChapter 9, part2File System Layout
Operating Systems Chapter 9, part2 File System Layout 1

OutlineQuestions.operations.CanIread back what I've written?·CanIgetbackfreespacewhenIremoveafile?·How much spaceis consumed whenIcreatea1GBfile?You'regiven a disk of 1TB space.How to utilize it?AllocatedFilecontent&DirectorySpaceattributesFreeSpaceThings needtobestored
2 Outline You’re given a disk of 1TB space. How to utilize it? Allocated Space Free Space File content & Directory attributes Things need to be stored. operations Questions. • Can I read back what I’ve written? • Can I get back free space when I remove a file? • How much space is consumed when I create a 1GB file?

Outline: We briefly introduce the evolution of the file systemlayout:- From a dummy way to advanced ways- The pros and cons are covered.: We begin to look at some details of the FAT filesystem and EXT file system3
3 Outline • We briefly introduce the evolution of the file system layout: – From a dummy way to advanced ways. – The pros and cons are covered. • We begin to look at some details of the FAT file system and EXT file system

How to store data? Consider the following case:- You are going to design the layout of a FS. You are given the freedom to choose the locationsto store files, including directory files- How will you organize the data?100GB04
4 How to store data? • Consider the following case: – You are going to design the layout of a FS. – You are given the freedom to choose the locations to store files, including directory files. – How will you organize the data? 0 100GB

How to store data?Some (basic) rules are required:- Every data written to the device must be able to be retrieved. Would you use the FS that will lose data randomly?-Every FS operation should be done as efficient as possible. Would you use the FS if it takes a minute to retrieve several bytes ofdata?Whenafileisremoved,theFS shouldfreethecorresponding space.. Would you use the Fs if it cannot free any occupied space?100GB05
5 How to store data? • Some (basic) rules are required: – Every data written to the device must be able to be retrieved. • Would you use the FS that will lose data randomly? – Every FS operation should be done as efficient as possible. • Would you use the FS if it takes a minute to retrieve several bytes of data? – When a file is removed, the FS should free the corresponding space. • Would you use the FS if it cannot free any occupied space? 0 100GB

File System LayoutTrial 1.0The Contiguous Allocation6
6 File System Layout Trial 1.0 The Contiguous Allocation

Trial 1.0-the basicsJust like a book!Table of contentChapter 1p.1Chapter 2p.2p.10Chapter 3BookVSTrial#1BookTrial#1FilenameChapterStarting PageStartingAddressNILEndingAddress
7 Trial 1.0 – the basics • Just like a book! Table of content Chapter 1 . p.1 Chapter 2 . p.2 Chapter 3 . p.10 Book VS Trial #1 Book Trial #1 Chapter Filename Starting Page Starting Address NIL Ending Address

Trial 1.0-thebasicsJust like a book!BookvSTrial#1BookTrial#1ChapterFilenameSuppose we have 3files to storeStarting PageStartingAddressNILrock.mp3Ending Addresssweet.jpgsame.exeLikeabook,we need to some spacetoWe donot considerthe directorystorethetable of content,which recordsstructureatthis momentthe filename and the (starting and ending)addresses of thefile content.8
8 Trial 1.0 – the basics • Just like a book! Book VS Trial #1 Book Trial #1 Chapter Filename Starting Page Starting Address NIL Ending Address Suppose we have 3 files to store rock.mp3 sweet.jpg same.exe We do not consider the directory structure at this moment Like a book, we need to some space to store the table of content, which records the filename and the (starting and ending) addresses of the file content

Trial 1.0-thebasics Just like a book!BookvSTrial#1BookTrial#1ChapterFilenameThetable ofcontent!Starting PageStartingAddressNILEndingAddressFilenameStartingEndingAddressAddress0rock.mp3200020013456sweet.jpgFile attributes50005678game.exe9
9 Trial 1.0 – the basics • Just like a book! The table of content! Book VS Trial #1 Book Trial #1 Chapter Filename Starting Page Starting Address NIL Ending Address Filename Starting Address Ending Address rock.mp3 0 2000 sweet.jpg 2001 3456 game.exe 5000 5678 File attributes

Trial 1.0-thebasicsJust like a book!Contiguous allocation is verysimilartotheway we write a book. It starts with the table ofcontent, which we call the root directoryThetableofcontent!FilenameStartingEndingAddressAddress0rock.mp3200020013456sweet.jpgFileattributes50005678game.exeRootrock.mp3sweet.jpggame.exeDirectory10
10 Trial 1.0 – the basics • Just like a book! The table of content! Filename Starting Address Ending Address rock.mp3 0 2000 sweet.jpg 2001 3456 game.exe 5000 5678 File attributes Contiguous allocation is very similar to the way we write a book. It starts with the table of content, which we call the root directory. Root Directory rock.mp3 sweet.jpg game.exe