Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Disk Scheduling Based on the slides supporting the text 1.
Allocation Methods - Contiguous
Chapter 10: File-System Interface
Chapter 11: File System Implementation
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
File System Implementation
File System Implementation
שאלות חזרה לבחינה. שאלה דיסקים אופטיים מסוג WORM (write-once-read-many) משמשים חברות לצורך איחסון כמויות גדולות של מידע באופן קבוע ומבלי שניתן לשנותו.
Based on the slides supporting the text
Chapter 12: File System Implementation
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
Disks.
Chapter 12: File System Implementation
1 Disk Scheduling Chapter 14 Based on the slides supporting the text.
04/05/2004CSCI 315 Operating Systems Design1 File System Implementation.
File System Implementation
04/07/2010CSCI 315 Operating Systems Design1 File System Implementation.
12.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 12: Mass-Storage Systems.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 12: Mass-Storage.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials– 8 th Edition Chapter 10: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
Dr. T. Doom 11.1 CEG 433/633 - Operating Systems I Chapter 11: File-System Implementation File structure –Logical storage unit –Collection of related information.
Free Space Management.
Silberschatz and Galvin  Operating System Concepts File-System Implementation File-System Structure Allocation Methods Free-Space Management.
Page 111/15/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  Allocation methods: Contiguous, Linked, Indexed,
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
10.1 CSE Department MAITSandeep Tayal 10 :File-System Implementation File-System Structure Allocation Methods Free-Space Management Directory Implementation.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 11 File-System Implementation Slide 1 Chapter 11: File-System Implementation.
Page 112/7/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  File system structure – layered, block based.
Operating Systems CMPSC 473 I/O Management (3) December 07, Lecture 24 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
1.  Disk Structure Disk Structure  Disk Scheduling Disk Scheduling  FCFS FCFS  SSTF SSTF  SCAN SCAN  C-SCAN C-SCAN  C-LOOK C-LOOK  Selecting a.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 13 Mass-Storage Systems Slide 1 Chapter 13 Mass-Storage Systems.
1 Chapter 13 Mass-Storage Structure. 2 Disk Structure Disk drives are addressed as large 1- dimensional arrays of logical blocks, where the logical block.
M ASS S TORAGE S TRUCTURES Lecture: Operating System Concepts Lecturer: Pooja Sharma Computer Science Department, Punjabi University, Patiala.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
File-System Implementation
Chapter 11: File System Implementation
Lecture 45 Syed Mansoor Sarwar
Chapter 14 Based on the slides supporting the text
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Chapter 11: File System Implementation
Overview Continuation from Monday (File system implementation)
Outline Allocation Free space management Memory mapped files
Overview: File system implementation (cont)
File-System Structure
Chapter 11: File System Implementation
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Presentation transcript:

Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation

12.2 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 11: File System Implementation Chapter 11: File System Implementation File System Structure File System Implementation Directory Implementation Allocation Methods Free-Space Management Efficiency and Performance Recovery Log-Structured File Systems

12.3 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary storage (disks). File system organized into layers.

12.4 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Layered File System Transfer information between the main memory and the disk system Issue generic commands to the appropriate device driver to read and write physical blocks of the disk Knows about files and their logical blocks as well as physical blocks Manages meta-data (all of the file-system structure, excluding the content of the files)

12.5 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java File-System Implementation Boot control block contains info needed by system to boot OS from that volume Volume control block contains volume details Directory structure organizes the files Per-file File Control Block (FCB) contains many details about the file

12.6 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java A Typical File Control Block (access control lists))

12.7 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Virtual File Systems The problem: How does an operating system allow multiple types of file systems to be integrated into a directory structure? Virtual File Systems (VFS) provide an object-oriented way of implementing file systems. VFS allows the same system call interface (the API) to be used for different types of file systems. The API is to the VFS interface, rather than any specific type of file system.

12.8 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Directory Implementation The selection of directory-allocation and directory management algorithm has a large effect on efficiency, performance and reliability Possible implementation (1) - Linear list of file names with pointer to the data blocks. simple to program time-consuming to execute Possible implementation (2) - Hash Table – linear list with hash data structure. decreases directory search time collisions – situations where two file names hash to the same location fixed size

12.9 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Disk Structure Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially. Sector 0 is the first sector of the first track on the outermost cylinder. Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost.

12.10 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Magnetic disks Magnetic disks – rigid metal or glass platters covered with magnetic recording material Disk surface is logically divided into tracks, which are subdivided into sectors. The disk controller determines the logical interaction between the device and the computer.

12.11 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Allocation Methods An allocation method refers to how disk blocks are allocated for files The challenge – utilizing the disk efficiently and access files quickly Methods: Contiguous allocation Linked allocation Indexed allocation

12.12 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Contiguous Allocation Each file occupies a set of contiguous blocks on the disk. Simple – only starting location (block #) and length (number of blocks) are required. Random access. Wasteful of space (dynamic storage-allocation problem), fragmentation – can be resolved with (expensive) compaction (requires down time) Files cannot grow.

12.13 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Contiguous Allocation of Disk Space

12.14 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Extent-Based Systems Many newer file systems (I.e. Veritas File System) use a modified contiguous allocation scheme. Extent-based file systems allocate disk blocks in extents. An extent is a contiguous block of sectors. Extents are allocated for file allocation. A file consists of one or more extents. Fragmentation: Internal (if extent is too large) External (if extents of varying sizes are used)

12.15 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Linked Allocation Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk. pointer block =

12.16 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Linked Allocation (Cont.) Simple – need only starting address Free-space management system – no waste of space (no need to declare file size, no compaction, no fragmentation) No random access Reliability problem (what if a pointer is lost?) File-allocation table (FAT) – disk-space allocation used by MS-DOS and OS/2.

12.17 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java File-Allocation Table Allocation of a new block – simply find the first one who has zero

12.18 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Indexed Allocation Brings all pointers together into the index block. Logical view. index table

12.19 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Example of Indexed Allocation

12.20 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Indexed Allocation (Cont.) Enables random access Without external fragmentation, but have overhead of index block. When file is created, all pointers in the index block are set to nil Any free block on the disk may satisfy a request for more space

12.21 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Indexed Allocation – Mapping (Cont.)  outer-index index table file

12.22 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Combined Scheme: UNIX (4K bytes per block)

12.23 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  0  block[i] free 1  block[i] occupied Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit Since disk space is limited, we need to reuse the space from deleted files for new files (if possible)

12.24 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Free-Space Management (Cont.) Bit map requires extra space. Example: block size = 2 12 bytes disk size = 2 30 bytes (1 gigabyte) n = 2 30 /2 12 = 2 18 bits (or 32K bytes) Easy to get contiguous files Linked list (free list) – see figure Cannot get contiguous space easily Grouping – allocate the first free block for storing the addresses of N free blocks (quickly find the addresses of a large number of free blocks when needed) Counting – store the address of a new free block and the number of subsequent free blocks

12.25 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Linked Free Space List on Disk

12.26 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Efficiency and Performance Efficiency dependent on: disk allocation and directory algorithms types of data kept in file’s directory entry Performance disk cache – separate section of main memory for frequently used blocks free-behind and read-ahead (instead of LRU) – techniques to optimize sequential access:  Remove page from the buffer as soon as the next page is requested  Read and cash requested page and several subsequent pages of file improve PC performance by dedicating section of memory as virtual disk (RAM disk) – accepts all standard file operations but perform them in memory

12.27 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Recovery Consistency checking – compares data in directory structure with data blocks on disk, and tries to fix inconsistencies. Use system programs to back up data from disk to another storage device (floppy disk, magnetic tape). Recover lost file or disk by restoring data from backup.

12.28 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Log Structured File Systems Log structured (or journaling) file systems record each update to the file system as a transaction. All transactions are written to a log. A transaction is considered committed once it is written to the log. However, the file system may not yet be updated. The transactions in the log are asynchronously written to the file system. When the file system is modified, the transaction is removed from the log.

12.29 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk bandwidth. Access time has two major components Seek time is the time for the disk are to move the heads to the cylinder containing the desired sector. Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head. Seek time  seek distance Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of the last transfer.

12.30 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Disk Scheduling (Cont.) Several algorithms exist to schedule the servicing of disk I/O requests. We illustrate them with a request queue (0-199). 98, 183, 37, 122, 14, 124, 65, 67 Head pointer 53

12.31 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java FCFS Illustration shows total head movement of 640 cylinders.

12.32 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java SSTF – shortest seek time first Selects the request with the minimum seek time from the current head position. SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests. Illustration shows total head movement of 236 cylinders.

12.33 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java SSTF (Cont.)

12.34 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java SCAN The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues. Sometimes called the elevator algorithm. Illustration shows total head movement of 208 cylinders.

12.35 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java SCAN (Cont.)

12.36 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java C-SCAN Provides a more uniform wait time than SCAN. The head moves from one end of the disk to the other. servicing requests as it goes. When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip. Treats the cylinders as a circular list that wraps around from the last cylinder to the first one.

12.37 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java C-SCAN (Cont.)

12.38 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java C-LOOK Version of C-SCAN Arm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk.

12.39 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java C-LOOK (Cont.)

12.40 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Selecting a Disk-Scheduling Algorithm SSTF is common and has a natural appeal SCAN and C-SCAN perform better for systems that place a heavy load on the disk. Performance depends on the number and types of requests. Requests for disk service can be influenced by the file-allocation method. The disk-scheduling algorithm should be written as a separate module of the operating system, allowing it to be replaced with a different algorithm if necessary. Either SSTF or LOOK is a reasonable choice for the default algorithm.

12.41 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Reliability A fixed disk drive is likely to be more reliable than a removable disk or tape drive. A head crash in a fixed hard disk generally destroys the data, whereas the failure of a tape drive or optical disk drive often leaves the data unharmed.

12.42 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java שאלה דיסקים אופטיים מסוג WORM (write-once-read-many) משמשים חברות לצורך איחסון כמויות גדולות של מידע באופן קבוע ומבלי שניתן לשנותו (למשל מידע פיננסי ורשומות חשבונאיות שלא ניתן למוחקן). בדיסקים אלו, כל סקטור ריק יכול להיכתב פעם אחת בלבד ולאחריה הוא הופך להיות זמין לקריאה בלבד. כנגזר מכך, לצורך שינוי של בלוק מסויים יש לכתוב אותו כבלוק חדש ולבצע את כל ההתאמות הנדרשות על מנת לשמור על מבנה ארגון הקובץ בדיסק. הינך נדרש לתכנן את מערכת הקבצים של דיסק WORM כך שניצול המקום בדיסק יהיה אופטימלי. האם תבחר להשתמש ב- (הקף את התשובה הנכונה) contiguous file allocation,, linked file allocation (הנח שימוש ב- FAT) או indexed file allocation? נמק מדוע השיטה שבחרת טובה יותר משתי השיטות האחרות עבור דיסק מסוג WORM.

12.43 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java תשובה השיטה הטובה ביותר היא indexed. הסיבה לכך היא שכאשר הקובץ משתנה, ניתן להקצות לטובת השינוי בלוקים חדשים ובמידת הצורך לכתוב מחדש את בלוק האינדקס החדש. באופן זה אם הקובץ רק מוסיף בלוקים חדשים או שיש בו מספר קטן של שינויים, הבלוקים של המידע שאיננו משתנה לא צריכים להיכתב מחדש. שיטת ה- contiguous ניתנת במקרה זה לשימוש על-ידי השארת בלוקים ריקים בסוף כל קובץ, כך שתוספת מידע בסוף הקובץ לא מחייבת כתיבה מחדש של הקובץ, אולם כל שינוי אחר לקובץ יחייב יצירת עותק חדש שלו על הדיסק. שיטת ה- linked allocation לא מתאימה כאן משום שטבלת ה- FAT תצטרך להיכתב מחדש בכל פעם שהקובץ משתנה (וכידוע טבלת ה- FAT היא לכל הבלוקים בדיסק). גם אם לא היינו משתמשים ב- FAT הרי ששינוי בבלוק מסויים היה מחייב כתיבה מחדש של כל הבלוקים שלפניו בשרשרת.

12.44 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java שאלה

12.45 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java תשובה 10

12.46 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java

12.47 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java

12.48 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java 1