goals for today
play

Goals for Today Learning Objective: Learn about directory - PowerPoint PPT Presentation

Goals for Today Learning Objective: Learn about directory structures Run through some disk performance exercises Announcements, etc: C4: I removed 2 papers from your reading list No longer need to read Multics Security Eval


  1. Goals for Today • Learning Objective: • Learn about directory structures • Run through some disk performance exercises • Announcements, etc: • C4: I removed 2 papers from your reading list • No longer need to read Multics Security Eval or SELinux • MP3 is out! Due April 18th . Reminder : Please put away devices at the start of class 1 CS 423: Operating Systems Design

  2. CS 423 
 Operating System Design: Directory Structures & Disk Performance Professor Adam Bates Spring 2018 CS 423: Operating Systems Design

  3. NTFS ■ Master File Table ■ Flexible 1KB storage for metadata and data ■ Extents ■ Block pointers cover runs of blocks ■ Similar approach in linux (ext4) ■ File create can provide hint as to size of file ■ Journalling for reliability CS 423: Operating Systems Design 3

  4. NTFS Master File Table MFT Record (small fj le) Std. Info. File Name Data (resident) (free) CS 423: Operating Systems Design 4

  5. NTFS MFT Start Data Extent Length MFT Record Std. Info. File Name Data (nonresident) (free) Start Data Extent Length CS 423: Operating Systems Design 5

  6. NTFS Indirect Block MFT MFT Record (part 1) Std. Info. Attr.list File Name Data (nonresident) Data Extent Data Extent MFT Record (part 2) Std. Info. Data (nonresident) (free) Data Extent Data Extent Data Extent CS 423: Operating Systems Design 6

  7. NTFS MFT MFT MFT Record MFT Record (small file) (huge/badly-fragmented file) Std. Info. Attr.list (nonresident) Std. Info. Data (resident) MFT Record Extent with part of attribute list (normal file) Std. Info. Data (nonresident) Data (nonresident) MFT Record Data (nonresident) (big/fragmented file) Std. Info. Attr.list Data (nonresident) Data (nonresident) Data (nonresident) Extent with part of attribute list Data (nonresident) Data (nonresident) Data (nonresident) Data (nonresident) CS 423: Operating Systems Design 7

  8. Named Data index structure directory fj le name fj le number storage o fg set o fg set block CS 423: Operating Systems Design 8

  9. Directory Structures ■ maps symbolic names into logical file names ■ search ■ create file ■ list directory ■ backup, archival, file migration ■ Directories are also files! music 320 work 219 foo.txt 871 CS 423: Operating Systems Design 9

  10. Directory Internals ■ Directories are also files! Special files ■ Denoted by “File Type” in inode ■ Hold access paths to the files in the file system ■ They have data blocks (inodes) on disk ■ Enables support for very large directories ■ The partition superblock points to the inode of the root directory. CS 423: Operating Systems Design 10

  11. Single-level Directory CS 423: Operating Systems Design 11

  12. Tree-Structured Directories CS 423: Operating Systems Design 12

  13. Directory Layout ■ Represent directory as a list of files ■ Linear search to find filename ■ Suitable for small directories File 830 � /home/tom � . .. music work foo.txt Name End of File 830 158 320 219 871 Free Space Free Space File Number Next CS 423: Operating Systems Design 13

  14. What can we do to improve efficient in large directories? CS 423: Operating Systems Design 14

  15. B Trees ■ Logarithmic search to find filename ■ Suitable for large directories Search for Hash (foo.txt) = 0x30 Root 240 510 730 980 Before Child Pointer Child Child 58 121 180 240 780 841 930 980 Before Child Pointer Leaf Leaf 15 30 44 58 Hash Entry Pointer 30 Hash Number . .. foo.txt music ... work code bin ... test Name 830 158 871 320 ... 219 3 014 ... 324 File Number CS 423: Operating Systems Design 15

  16. B Trees ■ Logarithmic search to find filename ■ Suitable for large directories File Containing Directory music work Root Child Leaf Leaf Child Name ... ... ... ... 320 219 File Number Directory Entries B+Tree Nodes CS 423: Operating Systems Design 16

  17. Recursive Filename Lookup File 2 bin 737 � � / � usr 924 home 158 File 158 mike 682 � � /home � ada 818 tom 830 File 830 music 320 � � /home/tom � work 219 foo.txt 871 File 871 The quick � � /home/tom/foo.txt � brown fox jumped over the lazy dog. CS 423: Operating Systems Design 17

  18. Tree-Structured Directories ■ arbitrary depth of directories ■ leaf nodes are files ■ interior nodes are directories ■ path name lists nodes to traverse to find node ■ use absolute paths from root ■ use relative paths from current working directory pointer CS 423: Operating Systems Design 18

  19. Tree-Structured Directories ■ We usually think of directories as trees… CS 423: Operating Systems Design 19

  20. Acyclic Graph Structured Dir.’s ■ But in practice they’re actually acyclic graphs! CS 423: Operating Systems Design 20

  21. Symbolic Links ■ Symbolic links are different than regular links (often called hard links ). Created with ln -s ■ Can be thought of as a directory entry that points to the name of another file. ■ Does not change link count for file When original deleted, symbolic link remains ■ ■ They exist because: Hard links don’t work across file systems ■ Hard links only work for regular files, not directories ■ direct Contents of file symlink direct Contents of file direct Hard link Symbolic Link CS 423: Operating Systems Design 21

  22. Changing Gears Some notes on disk performance… CS 423: Operating Systems Design 22

  23. Typical Modern Spec’s ■ Disk rotation speed: 5,000-15,000 RPM ■ Number of sectors per track: 500-2000 ■ Number of tracks: 100,000-200,000 ■ Average seek latency: 2ms ■ Block size: 0.5K-4K ■ Multiple zones (layout is different for inner and outer tracks) ■ Multiple bays (stacked drives) CS 423: Operating Systems Design 23

  24. Estimated Sustained Average Transfer Rate ■ Suppose that a disk drive spins at 7200 RPM (revolutions per minute), has a sector size of 512 bytes, and holds 160 sectors per track. ■ What is sustained average transfer rate of this drive in megabytes per second? A: Track. B: Sector. C: Sector of Track. D: File CS 423: Operating Systems Design 24

  25. Estimated Sustained Average Transfer Rate ■ Suppose that a disk drive spins at 7200 RPM (revolutions per minute), has a sector size of 512 bytes, and holds 160 sectors per track. ■ What is sustained average transfer rate of this drive in megabytes per second? Disk spins 120 times per second (7200 RPM/60) Each spin transfers a track of 80 KB (160 sectors x0.5K) Sustained average transfer rate is 120x80 = 9.6MB/s . CS 423: Operating Systems Design 25

  26. Average Performance of Random Access ■ Suppose that a disk drive spins at 7200 RPM (revolutions per minute), has a sector size of 512 bytes, and holds 160 sectors per track. ■ Average seek time for the drive is 8 milliseconds ■ Estimate # of random sector I/Os per second that can be done and the effective average transfer rate for random-access of a sector? Disk spins 120 times per second Average rotational cost is time to travel half track: 1/120 * 50%=4.167ms Transfer time is 8ms to seek + 4.167 ms rotational latency + 0.052 ms (reading one sector takes 0.0005MB/ 9.6MB). = 12.219 ms # of random sector access/second = 1/0.012219=81.8 Effective transferring rate: 0.5 KB * 81.8= 0.0409 MB/s . CS 423: Operating Systems Design 26

  27. Flash Memory ■ Electronically Erasable Programmable Read Only Memory (EEPROM) ■ Example specifications (NAND Flash): ■ Page size: 2KB (approx.) ■ Block size: 64 pages (128KB) ■ Device size: 16K blocks ■ Random READ: 25µs, Sequential READ: 25ns ■ WRITE performance ■ PROGRAM PAGE: 220µs, BLOCK ERASE: 1.5ms ■ Endurance: 100,000 PROGRAM/ERASE cycles CS 423: Operating Systems Design 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend