operating systems cmpsci 377 lecture 16 file systems ii n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Operating Systems CMPSCI 377 Lecture 16: File Systems II PowerPoint Presentation
Download Presentation
Operating Systems CMPSCI 377 Lecture 16: File Systems II

Loading in 2 Seconds...

play fullscreen
1 / 20

Operating Systems CMPSCI 377 Lecture 16: File Systems II - PowerPoint PPT Presentation


  • 128 Views
  • Uploaded on

Operating Systems CMPSCI 377 Lecture 16: File Systems II. Emery Berger University of Massachusetts, Amherst. Outline. File Systems Implementation How disks work How to organize data (files) on disks Data structures Placement of files on disk. Disk Surface Layout.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Operating Systems CMPSCI 377 Lecture 16: File Systems II' - dom


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
operating systems cmpsci 377 lecture 16 file systems ii

Operating SystemsCMPSCI 377Lecture 16: File Systems II

Emery Berger

University of Massachusetts, Amherst

outline
Outline
  • File Systems Implementation
    • How disks work
    • How to organize data (files) on disks
      • Data structures
      • Placement of files on disk
disk surface layout
Disk Surface Layout
  • Tracks: concentric rings on disk
    • bits laid out serially on tracks
  • Tracks split into sectors or blocks
    • Minimum unit of transfer from disk
disk pack multiple disks
Disk Pack: Multiple Disks
  • Disks organized in disk pack = stack of platters
  • Use both sides of platters
  • Two read-write heads at end of each arm
  • Cylinders =matching sectors on each surface
cost of disk operations
Cost of Disk Operations

In addition to CPU time to start disk operation:

  • Latency: time to initiate disk transfer
    • Seek time: time to position head over correct cylinder
    • Rotational time: time for correct sector to rotate under disk head
  • Bandwidth: rate of I/O transfer of sectors once initiated
outline1
Outline
  • File Systems Implementation
    • How disks work
    • How to organize data (files) on disks
      • Data structures
      • Placement of files on disk
file organization on disk
File Organization on Disk
  • File system maps file blocks to disk location
    • (file 0, block 0) = (platter 0, cylinder 0, sector 0)
  • Key performance issues:
    • Support sequential and random access
    • What data structure is best for maintaining file location information?
    • How do we lay out files on the disk?
on disk data structures
On-Disk Data Structures
  • File descriptor: structure used to describe where file is on disk and attributes
    • Must be stored on disks just like files
  • Most systems fit following profile:
    • Most files are small
    • Most disk space taken up by large files
    • I/O operations target both small & large
  • Per-file cost must be low, but large files must also have good performance
contiguous allocation
Contiguous Allocation
  • Operating system maintains ordered list of free disk blocks
  • OS allocates contiguous chunk of free blocks when it creates a file
    • Only need to store start location & size in file descriptor
contiguous allocation pros cons
Contiguous Allocation:Pros & Cons
  • Advantages
    • Simple
    • Access time? Number of seeks?
  • Disadvantages
    • Changing file sizes
    • Fragmentation? Disk management?
  • Examples: IBM OS/360, write-only disks, early PCs
linked files
Linked Files
  • Maintain list of all free sectors/blocks
  • In file descriptor, keep pointer to first sector/block
  • In each sector, keep pointer to next sector
linked files pros cons
Linked Files: Pros & Cons
  • Advantages
    • Fragmentation?
    • File size changes?
    • Efficiently supports which type of access?
  • Disadvantages:
    • Does not support which type of access? Why?
    • Number of seeks?
  • Examples: MS-DOS
indexed files
Indexed Files
  • OS keeps array of block pointers for each file
  • User or OS declares maximum length of file created
  • OS allocates array to hold pointers to all blocks when it creates file
    • But allocates blocks only on demand
  • OS fills pointers as it allocates blocks
indexed files pros cons
Indexed Files: Pros & Cons
  • Advantages
    • Wastes very little space
    • Sequential & random access: easy
  • Disadvantages
    • Sets maximum file size
    • Lots of seeks (why?)
multilevel indexed files
Multilevel Indexed Files
  • Each file descriptor contains 14 block pointers
  • First 12 pointers point to data blocks
  • 13th pointer: one indirection
    • Points to block of 1024 pointers to 1024 more data blocks
  • 14th pointer: two indirections
    • Points to block of pointers to indirect blocks
  • Used in BSD UNIX 4.3
multilevel indexed files pros cons
Multilevel Indexed Files:Pros & Cons
  • Advantages
    • Simple to implement
    • Supports incremental file growth
    • Small files?
  • Disadvantages
    • Indirect access: inefficient for random access to very large files
    • Lots of seeks (data not contiguous)
  • Is file size bounded?
  • What could OS do to get more contiguous memory?
free space management bitmaps
Free-Space Management: Bitmaps
  • Need free-space list to keep track of which disk blocks are free
    • Akin to free-list for main memory
  • One approach: bitmap
    • One bit per block on disk
    • Bit = 1 , block is free
    • Easy to find any page free in next 32 bits
  • Marking block free very simple
free space management
Free-Space Management
  • Problems:
    • Space: Bitmap has big RAM footprint
      • 80GB disk, 512 byte sectors = 5Mb
    • Performance: Slow if most of disk is in use
  • Alternative: link together free blocks
    • Head of list – cached in kernel memory
    • Each block contains next pointer
  • Cost of allocation? Freeing? Allocating consecutive blocks?
summary
Summary
  • Many of concerns & implementations of file systems similar to virtual memory implementations
    • Contiguous allocation: simple but...
      • External fragmentation, compaction, relocation...
    • Indexed allocation ~ page tables
    • Free space: managed with bitmap or linked lists
next time
Next Time
  • I/O Systems