15 Pages

ECE344-Lecture24-FileSystems

Course: ECE 344, Fall 2011
School: University of Toronto
Rating:
 
 
 
 
 

Word Count: 941

Document Preview

24: Lecture File Systems David Lie ECE344 University of Toronto 1 Outline File Systems Overview of file system Disk Basics File system design Consistency and crash recovery Sharing files Unix file system Disks Disk scheduling algorithms Redundancy in storage systems ECE344: Operating Systems 2 Buffer Cache Management File operations often access the same disk block E.g., block containing contents...

Register Now

Unformatted Document Excerpt

Coursehero >> Canada >> University of Toronto >> ECE 344

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
24: Lecture File Systems David Lie ECE344 University of Toronto 1 Outline File Systems Overview of file system Disk Basics File system design Consistency and crash recovery Sharing files Unix file system Disks Disk scheduling algorithms Redundancy in storage systems ECE344: Operating Systems 2 Buffer Cache Management File operations often access the same disk block E.g., block containing contents of root (/) directory Caching disk blocks in memory can reduce disk I/O Traditionally block cache is called a buffer cache Cache operations Block lookup If block in memory, returns data from buffer Block miss Read disk block into buffer, update buffer cache Block flush If buffer is modified, write it back to disk block ECE344: Operating Systems 3 Buffer Cache Organization Many blocks can be cached in memory (e.g., 1000s) Need to lookup block in memory efficiently how? Use a hash table key Device Block # Disk blocks in memory ECE344: Operating Systems 4 Buffer Cache Write Policy When a block needs to be written, the corresponding buffer in buffer cache is updated When is the disk block updated? Immediately (synchronously) Write-through cache Correct, but very slow Later (asynchronously) Write-back cache Fast, but what if system crashes? File system can become inconsistent ECE344: Operating Systems 5 Lazy Buffer Writes Example: say a file is created. Steps: 1. Inode allocated, free-space bitmap updated 2. Data block allocated, free-space bitmap updated 3. Inode updated to point to data block 4. Directory entry filled in 5. Directory entry updated to point to inode What if we had done 4-5 before 1-3? ECE344: Operating Systems 6 Crash Recovery File update operations generally require several block write operations For example, deleting a Unix file involves two steps 1. Removing its directory entry 2. Marking inode as free, and marking block as free in free map Imagine that a crash occurs between these writes FS data structures can be left in an invalid intermediate state Synchronous writing of directory and inode blocks reduces the problem but doesnt prevent it ECE344: Operating Systems 7 Crash Recovery Removing directory entry (1) is performed before marking blocks as free (2) during delete Suppose a crash occurs in between There will be an orphaned inode, hence a storage leak What if (2) is performed before (1)? Crash occurs in between Directory entry is a dangling pointer! Could point to freed blocks or to a new file More serious, hence Unix deletes in order (1) ECE344: Operating Systems 8 Crash Recovery In crash recovery, fixing system consistency is more important than recovering data blocks: If data blocks are corrupted on disk there is nothing you can do If file system is inconsistent then: There can be data blocks that cant be found There can be files whose data pointer point to the wrong data blocks There can be leaked blocks that cant be used Fixing file system consistency tools (fsck, chkdisk) Requires full a scan of the file system, rebuilding all pointer structures from scratch as well as free list. Dangling pointers are found, orphaned blocks are found ECE344: Operating Systems 9 Speeding up recovery: Journaling File Systems One way to speed up recovery is for the file system to keep a journal of operations: A separate part of the disk is dedicated to a circular log called a journal Operations are written to the journal first before committed to the actual file system. Each journal entry is idempotent. Example of journal entry might be: Remove file x from directory inode y, then mark inode of x as free. On recovery, replay all journal entries in log. ECE344: Operating Systems 10 Journaling File Systems Only file system pointer and block allocation/deallocation data stored journal: Actual data blocks are not stored to conserve space Recovery except for the last few operations is guaranteed: If journal entry is incomplete, then recovery system knows the operation never made it to disk: do nothing If journal entry is complete, operation might have made it to disk: since entries are idempotent, just redo them All major file systems use journals: Ext3/4, NTFS, ZFS (Sun), HFS (MacOS) ECE344: Operating Systems 11 Sharing Files Importance of file sharing should be clear Issues Concurrent access What happens when threads read and write a file simultaneously? Protection How should the OS ensure that only an authorized user can access a file? ECE344: Operating Systems 12 Concurrent Access OS ensures sequential consistency for processes on the same machine Defined as saying that there exists a total order that all processes perceive. Total order means: All processors see the same writes in the same order, i.e., if a file block has value 1 and then a 2 is written, then no process can read a 2 followed by a 1 Writes across different blocks also appear in the same order. If one process sees block B modified after block A, than all other processes must see the same order. ECE344: Operating Systems 13 Concurrency In network file systems sequential consistency is not guaranteed for every operation: Clients cache files locally for performance For sequential consistency, an write by one client would have to be updated to all other clients at the same time Many network file systems offer open-to-close consistency instead: While open, modifications to a file are not shared with other clients, other clients will may read old data before the open On close, then all modification are made visible atomically Guarantees are weak to maintain performance, files that are open for a long time may have partial data flushed back to file system server. ECE344: Operating Systems 14 Concurrency File systems do not guarantee atomicity automatically: Processes doing multiple operations on a file may have operations interleaved with those of other processes Must use a locking mechanism outside of FS to guarantee atomicity. ECE344: Operating Systems 15
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

University of Toronto - ECE - 344
Lecture 25: File SystemsDavid LieECE344University of Toronto1Outline File Systems Overview of file system Disk Basics File system design Consistency and crash recovery Sharing files Unix file system Disks Disk scheduling algorithms Redundan
University of Toronto - ECE - 344
Lecture 26: VirtualizationDavid LieECE344University of Toronto1System Virtualization Operating systems virtualize the CPU and devices so that youcan run multiple, independent processes: Each process is isolated, it believes it has exclusive access
University of Toronto - ECE - 344
Lecture 27: VirtualizationDavid LieECE344University of Toronto1Memory Virtualization Another challenge with VMM implementation is virtualizing theMMU: VMM needs to use MMU to isolate different guest OSs fromeach other Guest OSs need to use MMU t
University of Toronto - ECE - 344
Lab 0: OverviewDavid LieECE344University of Toronto1Lab Goals Get familiar with OS161 Learn to build and install a kernel and test environment Get familiar with tools: Cscope: source code navigation Subversion: versioning and collaboration GDB:
University of Toronto - ECE - 344
Lab 1: OverviewDavid LieECE344University of Toronto1Overview Review 3 synchronization types: Locks Semaphores Conditional Variables What is deadlock? Overview of synch.h Tips on DebuggingECE344: Operating Systems2
University of Toronto - ECE - 344
Lab 2: OverviewDavid LieECE344University of Toronto1Overview Some notes: How to use splhigh/splx Explanation of system callsECE344: Operating Systems2Splhigh/Splx These disable interrupts Think of this as a global lock for all threads. Everyt
University of Toronto - ECE - 344
Lab 2.1: OverviewDavid LieECE344University of Toronto1Function call flowsys_execvsys_forkthread_forkmd_forkentrymd_usermodemips_usermodeECE344: Operating Systems2Md_usermode vs md_forkentrySets up processor for going back to userspace for a
University of Toronto - ECE - 344
Lab 3.0: OverviewDavid LieECE344University of Toronto1Primer Look at kern/arch/mips/include/tlb.h: Description of the TLB interface0xc000000KSEG0 Understand memory layout of MIPS0x8000000 Look at kern/arch/mips/include/vm.h KUSEG: user progra
University of Toronto - ECE - 344
Lab 3.1: OverviewDavid LieECE344University of Toronto1Tasks Major Task: Implement as_copy() so you can support fork() Minor Task Implement sbrk()ECE344: Operating Systems2Implementing as_copy() As_copy() in dumbvm just does a keep copy of the
University of Toronto - ECE - 344
Lab 3.2: OverviewDavid LieECE344University of Toronto1TasksMajor Task: Implement SwappingMinor Task Performance counters and tuningECE344: Operating Systems2Implementing SwapOverview: In your coremap allocation function, you should currently
University of Toronto - CSC - 326
CSC326 Programming Languages (Lec1)CSC326 Programming Languages (Lec 1)iCSC326 Programming Languages (Lec1)iiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Programming Languages (Lec1)iiiContents1Agenda12Goal13Whats
University of Toronto - CSC - 326
CSC326 Python Imperative Core (Lec2)CSC326 Python Imperative Core (Lec 2)iCSC326 Python Imperative Core (Lec2)iiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Python Imperative Core (Lec2)iiiContents1Agenda12Invoking Py
University of Toronto - CSC - 326
CSC326 Python SequencesiCSC326 Python SequencesCSC326 Python SequencesiiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Python SequencesiiiContents1Agenda12while Statement13Sequence Overview24String25Lists46Dict
University of Toronto - CSC - 326
CSC326 Array Programming ParadigmiCSC326 Array Programming ParadigmCSC326 Array Programming ParadigmiiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Array Programming ParadigmiiiContents1Agenda12Array Programming Language
University of Toronto - CSC - 326
CSC326 Persistent ProgrammingiCSC326 Persistent ProgrammingCSC326 Persistent ProgrammingiiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Persistent ProgrammingiiiContents1Agenda12Persistent Programming13File14File na
University of Toronto - CSC - 326
CSC326 Object Oriented ProgrammingiCSC326 Object Oriented ProgrammingCSC326 Object Oriented ProgrammingiiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Object Oriented ProgrammingiiiContents1Agenda12Classes and Objects13
University of Toronto - CSC - 326
CSC326 Meta ProgrammingiCSC326 Meta ProgrammingCSC326 Meta ProgrammingiiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Meta ProgrammingiiiContents1Agenda12Class Factory13Meta Class14Decorator25Misuse of Decorators
University of Toronto - CSC - 326
CSC326 Functional ProgrammingiCSC326 Functional ProgrammingCSC326 Functional ProgrammingiiREVISION HISTORYNUMBERDATE1.02011-09DESCRIPTIONNAMEJZCSC326 Functional ProgrammingiiiContents1Agenda12Eliminating if13Eliminating Sequential S
Northwestern - PHYSICS - 102
Bernard WenSept. 23, 2010BP: A False FaadeAs one of the worlds largest energy companies, (Who We Are) BP is constantlyunder public scrutiny, so it is easy for the company to advertize a false faade of socialresponsibility. Its homepage is inundated w
University of Texas - EE - 351K
EE 351K Probability, Statistics, and Random ProcessesInstructor:S.ShakkottaiHomework 1 SolutionsProblem 1and P (A B ).SPRING 2012shakkott@ece.utexas.eduWe are given that P (A) = 0.6, P (B c ) = 0.45, and P (A B ) = 0.85. Determine P (B )Solution :
University of Texas - EE - 351K
EE 351K Probability, Statistics, and Random ProcessesInstructor:S.ShakkottaiHomework 1SPRING 2012shakkott@ece.utexas.eduProblem 1and P (A B ).We are given that P (A) = 0.6, P (B c ) = 0.45, and P (A B ) = 0.85. Determine P (B )Problem 2Let A and
University of Texas - EE - 351K
EE 351K Probability, Statistics, and Random ProcessesInstructor:S. ShakkottaiHomework 2 SolutionsSPRING 2012shakkott@ece.utexas.eduProblem 1A hard disk storing information in binary form has been corrupted, so it can only be read withbit errors. Du
University of Texas - EE - 351K
EE 351K Probability, Statistics, and Random ProcessesInstructor:S. ShakkottaiHomework 2SPRING 2012shakkott@ece.utexas.eduProblem 1A hard disk storing information in binary form has been corrupted, so it can only be read withbit errors. Due to error
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 3 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1Count the number of distinguishable ways in which you can arrange the letters in the words:(a) children(b) bookkeeperSol:
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 3FALL 2011sanghavi@mail.utexas.eduDue: September 22th in classProblem 1Count the number of distinguishable ways in which you can arrange the letters in the words:(a) children
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 4 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1There are n multiple-choice questions in an exam, each with 5 choices. The student knows the correctanswer to k of them, an
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 4FALL 2011sanghavi@mail.utexas.eduDue: September 29th in classProblem 1There are n multiple-choice questions in an exam, each with 5 choices. The student knows the correctans
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 5 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1Let Y be a random variable with probability density function (PDF) 1 + y, 1 y 0,y,0 < y 1,fY (y ) =0,otherwise.Find(
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 5FALL 2011sanghavi@mail.utexas.eduDue: October 13th in classProblem 1Let Y be a random variable with probability density function (PDF) 1 + y, 1 y 0,y,0 < y 1,fY (y ) =0,
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 6 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1(a) A re station is to be located at a point a along a road of length A, 0 < A < . If res willoccur at points uniformly cho
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 6FALL 2011sanghavi@mail.utexas.eduDue: October 20th in classProblem 1(a) A re station is to be located at a point a along a road of length A, 0 < A < . If res willoccur at po
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 7 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1Let X1 , X2 , . . . be independent random variables that are uniformly distributed over [1.1]. For each of thefollowing cas
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESFALL 2011Instructor: Sujay Sanghavisanghavi@mail.utexas.eduHomework 7Due: October 27th in classFocus: Limit Theorems, MAP Rule (Section 5.1-5.4, 8.1-8.2 in Textbook)Problem 1Let X1 , X2 , . . . be independent
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 8 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1Nefeli, a student in a probability class, takes a multiple-choice test with 10 questions and 3 choices perquestion. For eac
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESFALL 2011Instructor: Sujay Sanghavisanghavi@mail.utexas.eduHomework 8Due: November 2nd, 4:00pm (dropping it to mailbox @ENS 431)Focus: Bayesian Inference (Section 8.1-8.5 in Textbook)Problem 1Nefeli, a student
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 9 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1The parameter of an exponential random variable has to be estimated from one sample. What is the MLestimator? Is it unbiase
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 9Focus: ML Estimation (Chapter 9.1 in Textbook)FALL 2011sanghavi@mail.utexas.eduDue: November 22th in classProblem 1The parameter of an exponential random variable has to be
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 10 SolutionFALL 2011sanghavi@mail.utexas.eduProblem 1A radar works by transmitting a pulse, and seeing if there is an echo. Ideally, an echo means object ispresent, and no ech
University of Texas - EE - 351K
EE 351K PROBABILITY & RANDOM PROCESSESInstructor: Sujay SanghaviHomework 10Focus: Classical Statistical Inference (Chapter 9 in Textbook)FALL 2011sanghavi@mail.utexas.eduDue: December 5th @ ENS 428Problem 1A radar works by transmitting a pulse, an
University of Texas - EE - 319K
University of Texas - EE - 319K
1/11EE 319K Fall 2010 Final ExamRamesh YerraballiFull N ame(eid) :Duration: 3 hoursThis is a closed book exam; You may use your calculators; Write answers within the space (box)provided after each of the questions. There are 11 questions on the test
University of Texas - EE - 319K
1/11EE 319K Fall 2010 Final ExamRamesh YerraballiFull N ame(eid) :Duration: 3 hoursThis is a closed book exam; You may use your calculators; Write answers within the space (box)provided after each of the questions. There are 11 questions on the test
University of Texas - EE - 319K
1/11EE 319K Spring 2010 Final ExamRamesh YerraballiTThFull Name:Duration: 75 minutesThis is a closed book exam; You may use your calculators; Write answers within the spaceprovided after each of the questions. There are 7 questions on the test, rea
University of Texas - EE - 319K
1/11EE 319K Spring 2010 Final ExamRamesh YerraballiTThFull Name:Duration: 75 minutesThis is a closed book exam; You may use your calculators; Write answers within the spaceprovided after each of the questions. There are 7 questions on the test, rea
University of Texas - EE - 319K
1/11EE 319K Spring 2011 Final ExamRamesh YerraballiTThFull Name(eid):BME: Yes/NoDuration: 3 hoursThis is a closed book exam; You may use your calculators; Write answers within the space (box) providedafter each of the questions. There are 9 questi
University of Texas - EE - 319K
1/7EE 319K Fall 2010 First Mid-TermDr. Ramesh YerraballiFull Name (eid):()Duration: 75 minutesThis is a closed book exam; No calculators are allowed; Write answers within the spaceprovided after each of the questions. There are THREE questions on
University of Texas - EE - 319K
1/7EE 319K Fall 2010 First Mid-TermDr. Ramesh YerraballiFull Name (eid):()Duration: 75 minutesThis is a closed book exam; No calculators are allowed; Write answers within the spaceprovided after each of the questions. There are THREE questions on
University of Texas - EE - 319K
1 /8EE 319K Fall 2011 First Mid-TermDr. Ramesh YerraballiFull Name:Duration: 75 minutesSolutionEID:_Instructions: This is a closed book exam No calculators are allowed Write answers within the box/space provided after each of the questions. The
University of Texas - EE - 319K
1/8EE 319K Spring 2010 First Mid-TermDr. Ramesh YerraballiFull Name:Duration: 75 minutesThis is a closed book exam; No calculators are allowed; Write answers within the spaceprovided after each of the questions. There are FOUR questions on the test,
University of Texas - EE - 319K
1/8EE 319K Spring 2010 First Mid-TermDr. Ramesh YerraballiFull Name:Duration: 75 minutesThis is a closed book exam; No calculators are allowed; Write answers within the spaceprovided after each of the questions. There are FOUR questions on the test,
University of Texas - EE - 319K
1 /8EE 319K Spring 2011 First Mid-TermDr. Ramesh YerraballiFull Name:Duration: 75 minutesEID:_Instructions: This is a closed book exam No calculators are allowed Write answers within the box/space provided after each of the questions. If you need
University of Texas - EE - 319K
1 /8EE 319K Spring 2011 First Mid-TermDr. Ramesh YerraballiFull Name:Duration: 75 minutesEID:_Instructions: This is a closed book exam No calculators are allowed Write answers within the box/space provided after each of the questions. If you need
University of Texas - EE - 362K
University of Texas - EE - 362K
University of Texas - EE - 362K
University of Texas - EE - 362K
University of Texas - EE - 362K
University of Texas - M - 325k
Mann Fall 2011M325K Discrete MathematicsExam 1 ReviewExam 1 will be held during lecture class on Friday,Septemeber 16. Exam 1 will cover the following sections.2.1, 2.2, 2.33.1, 3.2, 3.3Students are expected to know the following.All definitionsV
University of Texas - M - 325k
Mann Fall 2011M325K Discrete MathematicsExam 2 ReviewExam 2 will be held during lecture class on Friday, October 14.Exam 2 will cover the following sections.3.44.1 4.4, 4.6, 4.75.1Students are expected to know the following: All definitions & how
University of Texas - M - 325k
Mann Fall 2011M325K Discrete MathematicsExam 3 ReviewExam 3 will be held during lecture class on Friday 11/11/11.Exam 3 will cover the following sections.5.2 5.46.1 6.47.1 7.2Students are expected to know the following: All definitions & how to a
University of Texas - M - 325k
Mann Fall 2011M325K Discrete MathematicsFinal Exam ReviewThe Final Exam will be Wednesday, December 7 in ourclassroom. The Final Exam will cover all sections we havediscussed this summer.You must show ALL your work on each problem to receivecredit!