Page 1. Review: Storage Performance" SSD Firmware Challenges" SSD Issues" CS162 Operating Systems and Systems Programming Lecture 14

Similar documents
Page 1. Recap: File System Goals" Recap: Linked Allocation"

CS162 Operating Systems and Systems Programming Lecture 14 File Systems (Part 2)"

Page 1. CS162 Operating Systems and Systems Programming Lecture 16. File Systems, Naming, Directories, and Caching"

CS162 Operating Systems and Systems Programming Lecture 19. File Systems continued Distributed Systems. Review: A Little Queuing Theory: Some Results

Page 1. CS194-3/CS16x Introduction to Systems. Lecture 15. Filesystems

Page 1. CS162 Operating Systems and Systems Programming Lecture 13. File Systems, Naming, Directories, and Caching"

CS162 Operating Systems and Systems Programming Lecture 18. File Systems, Naming, and Directories

Operating Systems (1DT020 & 1TT802) Lecture 11. File system Interface (cont d), Disk Management, File System Implementation.

CS162 Operating Systems and Systems Programming Lecture 18. File Systems, Naming, and Directories

Page 1. Quiz 13.1: Synchronization" Quiz 13.1: Synchronization" CS162 Operating Systems and Systems Programming Lecture 13. Disk/SSDs, File Systems"

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems. Page 1

Lecture S3: File system data layout, naming

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O

we are here I/O & Storage Layers Recall: C Low level I/O Recall: C Low Level Operations CS162 Operating Systems and Systems Programming Lecture 18

File Systems. CS170 Fall 2018

File Systems: Fundamentals

COMP 530: Operating Systems File Systems: Fundamentals

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 18: Naming, Directories, and File Caching

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 18: Naming, Directories, and File Caching

File Systems: Fundamentals

Recall: So What About a Real File System? Meet the inode: Recall: Unix File System (2/2) Recall: Unix File System (1/2)

File Layout and Directories

CS 318 Principles of Operating Systems

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

10/7/13! Anthony D. Joseph and John Canny CS162 UCB Fall 2013! " (0xE0)" " " " (0x70)" " (0x50)"

Disk Management and File Systems. Dr. Yingwu Zhu

Quiz 12.1: I/O" Quiz 13.1: Synchronization" Quiz 12.1: I/O" Page 1. CS162 Operating Systems and Systems Programming Lecture 13

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Operating Systems (1DT020 & 1TT802) Lecture 12. File System Implementation (continued) I/O systems. Léon Mugwaneza

CS 318 Principles of Operating Systems

CS162 Operating Systems and Systems Programming Lecture 12. Address Translation. Page 1

Page 1. CS162 Operating Systems and Systems Programming Lecture 20. Reliability and Access Control / Distributed Systems.

Chapter 11: File System Implementation. Objectives

Operating Systems. Operating Systems Professor Sina Meraji U of T

File Systems. Before We Begin. So Far, We Have Considered. Motivation for File Systems. CSE 120: Principles of Operating Systems.

Operating Systems. File Systems. Thomas Ropars.

Outlook. File-System Interface Allocation-Methods Free Space Management

CSE 120: Principles of Operating Systems. Lecture 10. File Systems. February 22, Prof. Joe Pasquale

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS162 Operating Systems and Systems Programming Lecture 20. Reliability and Access Control / Distributed Systems

Lecture 24: Filesystems: FAT, FFS, NTFS

CSE 120: Principles of Operating Systems. Lecture 10. File Systems. November 6, Prof. Joe Pasquale

CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBs"

Paging! 2/22! Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2012! " (0xE0)" " " " (0x70)" " (0x50)"

Page 1. Goals for Today" TLB organization" CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement"

ICS Principles of Operating Systems

I/O Performance" CS162 C o Operating Systems and Response" 300" Time (ms)" User" I/O" Systems Programming Thread" lle device" 200" Lecture 13 Queue"

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS 4284 Systems Capstone

Page 1. Review: Address Segmentation " Review: Address Segmentation " Review: Address Segmentation "

CS162 Operating Systems and Systems Programming Lecture 13. Caches and TLBs. Page 1

File System: Interface and Implmentation

UNIX File System. UNIX File System. The UNIX file system has a hierarchical tree structure with the top in root.

Principles of Operating Systems

EECS 482 Introduction to Operating Systems

CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement"

Main Points. File layout Directory layout

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems. Review: Want Standard Interfaces to Devices

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

Frequently asked questions from the previous class survey

FILE SYSTEMS, PART 2. CS124 Operating Systems Fall , Lecture 24

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 13: Address Translation

File Systems. What do we need to know?

File Systems. CS 4410 Operating Systems. [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]

File Systems: Interface and Implementation

Disk Scheduling COMPSCI 386

EECE.4810/EECE.5730: Operating Systems Spring 2017

Chapter 4 File Systems. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

Midterm Exam #2 Solutions April 20, 2016 CS162 Operating Systems

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

e-pg Pathshala Subject: Computer Science Paper: Operating Systems Module 35: File Allocation Methods Module No: CS/OS/35 Quadrant 1 e-text

File System Structure. Kevin Webb Swarthmore College March 29, 2018

ECE 650 Systems Programming & Engineering. Spring 2018

[537] Fast File System. Tyler Harter

File Management By : Kaushik Vaghani

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

File Systems. Chapter 11, 13 OSPP

Filesystems Lecture 10. Credit: some slides by John Kubiatowicz and Anthony D. Joseph

csci 3411: Operating Systems

FILE SYSTEM IMPLEMENTATION. Sunu Wibirama

Page 1. Goals for Today" Virtualizing Resources" Important Aspects of Memory Multiplexing" CS162 Operating Systems and Systems Programming Lecture 20

File Systems. ECE 650 Systems Programming & Engineering Duke University, Spring 2018

Chapter 7: File-System

Midterm Exam #3 Solutions November 30, 2016 CS162 Operating Systems

CS 550 Operating Systems Spring File System

File Systems. CS 4410 Operating Systems

Operating System Concepts Ch. 11: File System Implementation

Introduction. Secondary Storage. File concept. File attributes

Operating Systems. Lecture File system implementation. Master of Computer Science PUF - Hồ Chí Minh 2016/2017

TDDB68 Concurrent Programming and Operating Systems. Lecture: File systems

3/3/2014! Anthony D. Joseph!!CS162! UCB Spring 2014!

Lecture 18: Reliable Storage

CS370 Operating Systems

File System Implementation. Sunu Wibirama

CSE 451: Operating Systems Spring Module 12 Secondary Storage. Steve Gribble

Midterm #2 Exam April 26, 2006 CS162 Operating Systems

CSE 451: Operating Systems Spring Module 12 Secondary Storage

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

OPERATING SYSTEMS CS136

Transcription:

Review: Storage Performance" Hard (Magnetic) Disk Performance: CS162 Operating Systems and Systems Programming Lecture 14 Latency = Queuing time + Controller + Seek + Rotational + Transfer Rotational latency: on average ½ rotation Transfer time: depends on rotation speed and bit density SSD Performance: File Systems (Part 2)" Read: Queuing time + Controller + Transfer Write: Queuing time + Controller (Find Free Block) + Transfer Find Free Block time: depends on how full SSD is (available empty pages), write burst duration, Limited drive lifespan October 23, 2013 Anthony D. Joseph and John Canny http://inst.eecs.berkeley.edu/~cs162 10/23/2013 SSD Issues" Anthony D. Joseph and John Canny CS162 UCB Fall 2013 Lec 14.2 SSD Firmware Challenges" Wear leveling and background garbage collection Writes/Erase damage memory cells, limits SSD lifespan Controller uses ECC, performs wear leveling 10/23/2013 Anthony D. Joseph and John Canny CS162 UCB Fall 2013 10/23/2013 Lec 14.3 Page 1 Anthony D. Joseph and John Canny CS162 UCB Fall 2013 Lec 14.4

Review: File System Goals" Review: Linked Allocation" Maximize sequential performance Efiicient random access to file Easy management of files (growth, truncation, etc) Lec 14.5 MSDOS links pages together to create a file Links not in pages, but in the File Allocation Table (FAT)» FAT contains an entry for each block on the disk» FAT Entries corresponding to blocks of file linked together Access properties:» Sequential access expensive unless FAT cached in memory» Random really expensive if FAT not cached Lec 14.6 Goals for Today" File Systems Structures (contʼd) Naming and Directories Note: Some slides and/or pictures in the following are" adapted from slides 2005 Silberschatz, Galvin, and Gagne. " Many slides generated from my lecture notes by Kubiatowicz." Lec 14.7 Multilevel Indexed Files (UNIX 4.1) " Multilevel Indexed Files: (from UNIX 4.1 BSD) Key idea: efficient for small files, but still allow big files File hdr contains 13 pointers Fixed size table, pointers not all equivalent This header is called an inode in UNIX File Header format: First 10 pointers are to data blocks Ptr 11 points to indirect block containing 256 block ptrs Pointer 12 points to doubly indirect block containing 256 indirect block ptrs for total of 64K blocks Pointer 13 points to a triply indirect block (16M blocks) Lec 14.8 Page 2

Multilevel Indexed Files (UNIX 4.1): Discussion " Basic technique places an upper limit on file size that is approximately 16Gbytes Designers thought this was bigger than anything anyone would need. Much bigger than a disk at the time Fallacy: today, Facebook gets hundreds of TBs of logs every day Pointers get filled in dynamically: need to allocate indirect block only when file grows > 10 blocks On small files, no indirection needed Lec 14.9 Example of Multilevel Indexed Files" Sample file in multilevel indexed format: How many accesses for block #23? (assume file header accessed on open)?» Two: One for indirect block, one for data How about block #5?» One: One for data Block #340?» Three: double indirect block, indirect block, and data UNIX 4.1 Pros and cons Pros: Simple (more or less) Files can easily expand (up to a point) Small files particularly cheap and easy Cons: Lots of seeks Very large files must read many indirect blocks (four I/Oʼs per block) Lec 14.10 UNIX BSD 4.2" Same as BSD 4.1 (same file header and triply indirect blocks), except incorporated ideas from Cray-1 DEMOS: Uses bitmap allocation in place of freelist Attempt to allocate files contiguously 10% reserved disk space (mentioned next slide) Skip-sector positioning (mentioned in two slides) How to Deal with Full Disks?" In many systems, disks are always full EECS department growth: 300 GB to 1TB in a year (now 10s TB) Problem: When create a file, donʼt know how big it will become (in UNIX, most writes are by appending) How much contiguous space do you allocate for a file? In BSD 4.2, just find some range of free blocks» Put each new file at the front of different range» To expand a file, you first try successive blocks in bitmap, then choose new range of blocks Also in BSD 4.2: store files from same directory near each other Lec 14.11 Lec 14.12 Page 3

UNIVERSITY OF CALIFORNIA Berkeley Instructional and Research ELECTRICAL ENGINEERING AND COMPUTER SCIENCES UNIVERSITY OF CALIFORNIA Berkeley Information Systems Billable Storage (in GB) Project Home 25000 20000 15000 10000 5000 IMAP 0 1/1/2005 1/1/2007 1/1/2009 1/1/2011 1/1/2013 Restructure Rates Rate Drop Rate Drop How to Deal with Full Disks?" In many systems, disks are always full EECS department growth: 300 GB to 1TB in a year (now 10s TB) How to fix? Announce disk space is low, so please delete files?» Donʼt really work: people try to store their data faster Sidebar: Perhaps we are getting out of this mode with new disks However, letʼs assume disks are full for now Solution: Donʼt let disks get completely full: reserve portion» Free count = # blocks free in bitmap» Scheme: Donʼt allocate data if count < reserve How much reserve do you need?» In practice, 10% seems like enough Tradeoff: pay for more disk, get contiguous allocation» Since seeks so expensive for performance, this is a very good tradeoff Lec 14.13 Lec 14.14 Attack of the Rotational Delay" Problem: Missing blocks due to rotational delay Issue: Read one block, do processing, and read next block. In meantime, disk has continued turning: missed next block Skip Sector Administrivia" Midterm results: Mean: 69.71, Median: 71.75, Std Dev: 14.24 60 50 40 Solution 1: Skip sector positioning ( interleaving )» Place the blocks from one file on every other block of a track: give time for processing to overlap rotation Solution 2: Read ahead: read next block right after first, even if application hasnʼt asked for it yet» This can be done either by OS (read ahead)» By disk itself (track buffers). Many disk controllers have internal RAM that allows them to read a complete track Important Aside: Modern disks+controllers do many complex things under the covers Track buffers, elevator algorithms, bad block filtering Track Buffer (Holds complete track) Lec 14.15 Count 30 20 10 0 Up To 10 10 To 20 20 To 30 30 To 40 40 To 50 50 To 60 60 To 70 70 To 80 80 To 90 90 To 100 More Regrade request deadline: October 25, 2013 by 11:59pm We will regrade the entire exam Please fill out the anonymous course survey at https://www.surveymonkey.com/s/fsw3hvj Weʼll try to make changes this semester based on your feedback Lec 14.16 Page 4

Q1: True _ False _ With FAT, pointers are maintained in the data blocks Q2: True _ False _ Unix file system is more efficient than FAT for random access Q3: True _ False _ The Skip Sector Positioning technique allows reading consecutive blocks on a track Q4: True _ False _ Maintaining the free blocks in a list is more efficient than using a bitmap Q5: True _ False _ In Unix, accessing random data in a large file is on average slower than in a small file Quiz 14.1: File Systems" Lec 14.17 5min Break" Lec 14.18 Quiz 14.1: File Systems" How do we actually access files?" Q1: True _ False _ X" With FAT, pointers are maintained in the data blocks Q2: True _ X" False _ Unix file system is more efficient than FAT for random access Q3: True X" _ False _ The Skip Sector Positioning technique allows reading consecutive blocks on a track Q4: True _ False _ X" Maintaining the free blocks in a list is more efficient than using a bitmap Q5: True _ X" False _ In Unix, accessing random data in a large file is on average slower than in a small file Lec 14.19 All information about a file contained in its file header UNIX calls this an inode» Inodes are global resources identified by index ( inumber ) Once you load the header structure, all blocks of file are locatable Question: how does the user ask for a particular file? One option: user specifies an inode by a number (index).» Imagine: open( 14553344 ) Better option: specify by textual name» Have to map name inumber Another option: Icon» This is how Apple made its money. Graphical user interfaces. Point to a file and click Lec 14.20 Page 5

Naming" Naming (name resolution): process by which a system translates from user-visible names to system resources In the case of files, need to translate from strings (textual names) or icons to inumbers/inodes For global file systems, data may be spread over globe need to translate from strings or icons to some combination of physical server location and inumber Directories" Directory: a relation used for naming Just a table of (file name, inumber) pairs How are directories constructed? Directories often stored in files» Reuse of existing mechanism» Directory named by inode/inumber like other files Needs to be quickly searchable» Options: Simple list or Hashtable» Can be cached into memory in easier form to search How are directories modified? Originally, direct read/write of special file System calls for manipulation: mkdir, rmdir Ties to file creation/destruction» On creating a file by name, new inode grabbed and associated with new file in particular directory Lec 14.21 Lec 14.22 Directory Organization" Directory Structure" Directories organized into a hierarchical structure Seems standard, but in early 70ʼs it wasnʼt Permits much easier organization of data structures Entries in directory can be either files or directories Files named by ordered set (e.g., /programs/p/list) Not really a hierarchy Many systems allow directory structure to be organized as an acyclic graph or even a (potentially) cyclic graph Hard Links: different names for the same file» Multiple directory entries point at the same file Soft Links: shortcut pointers to other files» Implemented by storing the logical name of actual file Lec 14.23 Lec 14.24 Page 6

Directory Structure" Name Resolution: The process of converting a logical name into a physical resource (like a file) Traverse succession of directories until reach target file Global file system: May be spread across the network Directory Structure (Conʼt)" How many disk accesses to resolve /my/book/count? Read in file header for root (fixed spot on disk) Read in first data block for root» Table of file name/index pairs. Search linearly ok since directories typically very small Read in file header for my Read in first data block for my ; search for book Read in file header for book Read in first data block for book ; search for count Read in file header for count Current working directory: Per-address-space pointer to a directory (inode) used for resolving file names Allows user to specify relative filename instead of absolute path (say CWD= /my/book can resolve count ) Lec 14.25 Lec 14.26 Where are inodes stored?" In early UNIX and DOS/Windowsʼ FAT file system, headers stored in special array in outermost cylinders Header not stored anywhere near the data blocks. To read a small file, seek to get header, seek back to data. Fixed size, set when disk is formatted. At formatting time, a fixed number of inodes were created (They were each given a unique number, called an inumber ) Where are inodes stored?" Later versions of UNIX moved the header information to be closer to the data blocks Often, inode for file stored in same cylinder group as parent directory of the file (makes an ls of that directory run fast). Pros:» UNIX BSD 4.2 puts a portion of the file header array on each cylinder. For small directories, can fit all data, file headers, etc. in same cylinder no seeks» File headers much smaller than whole block (a few hundred bytes), so multiple headers fetched from disk at same time» Reliability: whatever happens to the disk, you can find many of the files (even if directories disconnected) Part of the Fast File System (FFS)» General optimization to avoid seeks Lec 14.27 Lec 14.28 Page 7

In-Memory File System Structures" In-Memory File System Structures" Open system call: Resolves file name, finds file control block (inode) Makes entries in per-process and system-wide tables Returns index (called file handle ) in open-file table Read/write system calls: Use file handle to locate inode Perform appropriate reads or writes Lec 14.29 Lec 14.30 Quiz 14.2: File Systems" Quiz 14.2: File Systems" Q1: True _ False _ A hard-link is a pointer to other file Q2: True _ False _ inumber is the id of a block Q3: True _ False _ Typically, directories are stored as files Q4: True _ False _ Storing file headers on the outermost cylinders minimizes the seek time Q1: True _ False _ X" A hard-link is a pointer to other file Q2: True _ False _ X" inumber is the id of a block Q3: True X" _ False _ Typically, directories are stored as files Q4: True _ False _ X" Storing file headers on the outermost cylinders minimizes the seek time Lec 14.31 Lec 14.32 Page 8

File System Summary (1/2)" File System: Transforms blocks into Files and Directories Optimize for access and usage patterns Maximize sequential access, allow efficient random access File (and directory) defined by header, called inode Multilevel Indexed Scheme Inode contains file info, direct pointers to blocks, indirect blocks, doubly indirect, etc.. File System Summary (2/2)" 4.2 BSD Multilevel index files Inode contains pointers to actual blocks, indirect blocks, double indirect blocks, etc. Optimizations for sequential access: start new files in open ranges of free blocks, rotational Optimization Naming: act of translating from user-visible names to actual system resources Directories used for naming for local file systems Lec 14.33 Lec 14.34 Page 9