CSE 153 Design of Operating Systems

Similar documents
CSE 153 Design of Operating Systems Fall 2018

CS 201 The Memory Hierarchy. Gerson Robboy Portland State University

Storage Technologies and the Memory Hierarchy

CS 33. Memory Hierarchy I. CS33 Intro to Computer Systems XVI 1 Copyright 2016 Thomas W. Doeppner. All rights reserved.

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, SPRING 2013

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture

Computer Organization: A Programmer's Perspective

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, FALL 2012

Computer Systems. Memory Hierarchy. Han, Hwansoo

Giving credit where credit is due

Random Access Memory (RAM)

CISC 360. The Memory Hierarchy Nov 13, 2008

The Memory Hierarchy /18-213/15-513: Introduction to Computer Systems 11 th Lecture, October 3, Today s Instructor: Phil Gibbons

Random-Access Memory (RAM) Lecture 13 The Memory Hierarchy. Conventional DRAM Organization. SRAM vs DRAM Summary. Topics. d x w DRAM: Key features

Random-Access Memory (RAM) CS429: Computer Organization and Architecture. SRAM and DRAM. Flash / RAM Summary. Storage Technologies

The Memory Hierarchy Sept 29, 2006

Foundations of Computer Systems

STORAGE SYSTEMS. Operating Systems 2015 Spring by Euiseong Seo

CSE 451: Operating Systems Winter Lecture 12 Secondary Storage. Steve Gribble 323B Sieg Hall.

Key features. ! RAM is packaged as a chip.! Basic storage unit is a cell (one bit per cell).! Multiple RAM chips form a memory.

CSE 451: Operating Systems Winter Secondary Storage. Steve Gribble. Secondary storage

Today. The Memory Hierarchy. Random-Access Memory (RAM) Nonvolatile Memories. Traditional Bus Structure Connecting CPU and Memory

I/O & Storage. Jin-Soo Kim ( Computer Systems Laboratory Sungkyunkwan University

NEXT SET OF SLIDES FROM DENNIS FREY S FALL 2011 CMSC313.

The Memory Hierarchy / : Introduction to Computer Systems 10 th Lecture, Feb 12, 2015

CSE 451: Operating Systems Spring Module 12 Secondary Storage

Today. The Memory Hierarchy. Byte Oriented Memory Organization. Simple Memory Addressing Modes

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

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Hard Disk Drives (HDDs) Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Secondary storage. CS 537 Lecture 11 Secondary Storage. Disk trends. Another trip down memory lane

COS 318: Operating Systems. Storage Devices. Vivek Pai Computer Science Department Princeton University

Hard Disk Drives (HDDs)

CSE 120 Principles of Operating Systems

UNIT 2 Data Center Environment

Operating Systems. Operating Systems Professor Sina Meraji U of T

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

COS 318: Operating Systems. Storage Devices. Jaswinder Pal Singh Computer Science Department Princeton University

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

COS 318: Operating Systems. Storage Devices. Kai Li Computer Science Department Princeton University

Module 1: Basics and Background Lecture 4: Memory and Disk Accesses. The Lecture Contains: Memory organisation. Memory hierarchy. Disks.

The. Memory Hierarchy. Chapter 6

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

u Covered: l Management of CPU & concurrency l Management of main memory & virtual memory u Currently --- Management of I/O devices

CS420: Operating Systems. Mass Storage Structure

Hard Disk Drives. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)

CSE 120 Principles of Operating Systems

Carnegie Mellon. Carnegie Mellon

Giving credit where credit is due

Random-Access Memory (RAM) CISC 360. The Memory Hierarchy Nov 24, Conventional DRAM Organization. SRAM vs DRAM Summary.

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Secondary storage. File systems

Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done?

Announcements. Outline

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

CHAPTER 12: MASS-STORAGE SYSTEMS (A) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Introduction to I/O and Disk Management

Storage. CS 3410 Computer System Organization & Programming

Introduction to I/O and Disk Management

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14

EECS 482 Introduction to Operating Systems

CS3600 SYSTEMS AND NETWORKS

The Memory Hierarchy 10/25/16

[537] I/O Devices/Disks. Tyler Harter

Computer Science 61C Spring Friedland and Weaver. Input/Output

Mass-Storage. ICS332 - Fall 2017 Operating Systems. Henri Casanova

Today: Secondary Storage! Typical Disk Parameters!

A Computer. Computer organization - Recap. The Memory Hierarchy... Brief Overview of Memory Design. CPU has two components: Memory

CS 2461: Computer Architecture 1 The Memory Hierarchy and impact on program performance

CSCI-UA.0201 Computer Systems Organization Memory Hierarchy

CS 261 Fall Mike Lam, Professor. Memory

Disks October 22 nd, 2010

Chapter 11. I/O Management and Disk Scheduling

Mass-Storage Structure

Disk Scheduling COMPSCI 386

Anatomy of a disk. Stack of magnetic platters. Disk arm assembly

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Chapter 12: Mass-Storage

CSE506: Operating Systems CSE 506: Operating Systems

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Lecture 29. Friday, March 23 CS 470 Operating Systems - Lecture 29 1

Memory Hierarchy. Instructor: Adam C. Champion, Ph.D. CSE 2431: Introduction to Operating Systems Reading: Chap. 6, [CSAPP]

Disks: Structure and Scheduling

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

Mass-Storage Systems

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017

V. Mass Storage Systems

Chapter 10: Mass-Storage Systems

Computer Architecture and System Software Lecture 09: Memory Hierarchy. Instructor: Rob Bergen Applied Computer Science University of Winnipeg

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Computer Organization: A Programmer's Perspective

I/O CANNOT BE IGNORED

CSC369 Lecture 9. Larry Zhang, November 16, 2015

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568

Lecture 16: Storage Devices

CS370 Operating Systems

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018

Principles of Operating Systems CS 446/646

Chapter 6. Storage & Other I/O

Transcription:

CSE 153 Design of Operating Systems Winter 2018 Lecture 20: File Systems (1) Disk drives

OS Abstractions Applications Process File system Virtual memory Operating System CPU Hardware Disk RAM CSE 153 Lecture 20 File Systems 2

File Systems Agenda First we ll discuss properties of physical disks Structure, Performance Scheduling Then we ll discuss how to build file systems (next time) Abstraction:» Files» Directories» Sharing» Protection Implementation» File System Layouts» File Buffer Cache» Read Ahead CSE 153 Lecture 20 File Systems 3

Disks and the OS Disks are messy physical devices: Errors, bad blocks, missed seeks, etc. OS s job is to hide this mess from higher level software Low-level device control (initiate a disk read, etc.) Os provides Higher-level abstractions (files, databases, etc.) OS maps them to the device and implements policies to promote» Performance, reliability, protection, CSE 153 Lecture 20 File Systems 4

What s Inside A Disk Drive? Arm Spindle Platters Actuator SCSI connector Electronics (including a processor and memory!) CSE 153 Lecture 20 File Systems 5 Image courtesy of Seagate Technology

Physical Disk Structure Disk components Platters Surfaces Tracks Sectors Cylinders Arm Heads Arm Arm Heads Track Platter Surface Cylinder Sector (512 bytes) CSE 153 Lecture 20 File Systems 6

Disk Geometry Disks consist of platters, each with two surfaces. Each surface consists of concentric rings called tracks. Each track consists of sectors separated by gaps. Tracks Surface Track k Gaps Spindle Sectors CSE 153 Lecture 20 File Systems 7

Disk Geometry (Muliple- Platter View) Aligned tracks form a cylinder. Cylinder k Surface 0 Surface 1 Surface 2 Surface 3 Surface 4 Surface 5 Platter 0 Platter 1 Platter 2 Spindle CSE 153 Lecture 20 File Systems 8

Disk Capacity Capacity: maximum number of bits that can be stored. Capacity is determined by these technology factors: Recording density (bits/in): number of bits that can be squeezed into a 1 inch segment of a track. Track density (tracks/in): number of tracks that can be squeezed into a 1 inch radial segment. Areal density (bits/in2): product of recording and track density. Modern disks partition tracks into disjoint subsets called recording zones Each track in a zone has the same number of sectors, determined by the circumference of innermost track. Each zone has a different number of sectors/track CSE 153 Lecture 20 File Systems 9

Computing Disk Capacity Capacity = (# bytes/sector) x (avg. # sectors/track) x Example: (# tracks/surface) x (# surfaces/platter) x (# platters/disk) 512 bytes/sector 300 sectors/track (on average) 20,000 tracks/surface 2 surfaces/platter 5 platters/disk Capacity = 512 x 300 x 20000 x 2 x 5 = 30,720,000,000 = 30.72 GB CSE 153 Lecture 20 File Systems 10

Disk Operation (Single-Platter View) The disk surface spins at a fixed rotational rate The read/write head is attached to the end of the arm and flies over the disk surface on a thin cushion of air. spindle spindle spindle spindle By moving radially, the arm can position the read/write head over any track. CSE 153 Lecture 20 File Systems 11

Disk Operation (Multi-Platter View) Read/write heads move in unison from cylinder to cylinder Arm Spindle CSE 153 Lecture 20 File Systems 12

Disk Structure - top view of single platter Surface organized into tracks Tracks divided into sectors CSE 153 Lecture 20 File Systems 13

Disk Access Head in position above a track CSE 153 Lecture 20 File Systems 14

Disk Access Rotation is counter-clockwise CSE 153 Lecture 20 File Systems 15

Disk Access Read About to read blue sector CSE 153 Lecture 20 File Systems 16

Disk Access Read After BLUE read After reading blue sector CSE 153 Lecture 20 File Systems 17

Disk Access Read After BLUE read Red request scheduled next CSE 153 Lecture 20 File Systems 18

Disk Access Seek After BLUE read Seek for RED Seek to red s track CSE 153 Lecture 20 File Systems 19

Disk Access Rotational Latency After BLUE read Seek for RED Rotational latency Wait for red sector to rotate around CSE 153 Lecture 20 File Systems 20

Disk Access Read After BLUE read Seek for RED Rotational latency After RED read Complete read of red CSE 153 Lecture 20 File Systems 21

Disk Access Service Time Components After BLUE read Seek for RED Rotational latency After RED read Data transfer Seek Rotational latency Data transfer CSE 153 Lecture 20 File Systems 22

Disk Access Time Average time to access some target sector approximated by : Taccess = Tavg seek + Tavg rotation + Tavg transfer Seek time (Tavg seek) Time to position heads over cylinder containing target sector. Typical Tavg seek is 3 9 ms Rotational latency (Tavg rotation) Time waiting for first bit of target sector to pass under r/w head. Tavg rotation = 1/2 x 1/RPMs x 60 sec/1 min Typical Tavg rotation = 7200 RPMs Transfer time (Tavg transfer) Time to read the bits in the target sector. Tavg transfer = 1/RPM x 1/(avg # sectors/track) x 60 secs/1 min. 23

Disk Access Time Example Given: Rotational rate = 7,200 RPM Average seek time = 9 ms. Avg # sectors/track = 400. Derived: Tavg rotation = 1/2 x (60 secs/7200 RPM) x 1000 ms/sec = 4 ms. Tavg transfer = 60/7200 RPM x 1/400 secs/track x 1000 ms/sec = 0.02 ms Taccess = 9 ms + 4 ms + 0.02 ms Important points: Access time dominated by seek time and rotational latency. First bit in a sector is the most expensive, the rest are free. SRAM access time is about 4 ns/doubleword, DRAM about 60 ns» Disk is about 40,000 times slower than SRAM,» 2,500 times slower then DRAM. 24

Logical Disk Blocks Modern disks present a simpler abstract: The set of available sectors is modeled as a sequence of b- sized logical blocks (0, 1, 2,...) Mapping between logical and actual (physical) sectors Maintained by a device called disk controller. Converts requests for logical blocks into (surface,track,sector) Allows controller to set aside spare cylinders for each zone. Accounts for the difference in formatted capacity and maximum capacity. CSE 153 Lecture 20 File Systems 25

I/O and disk in the system CSE 153 Lecture 20 File Systems 26

Motherboard CSE 153 Lecture 20 File Systems 27

I/O Bus CPU chip Register file ALU System bus Memory bus Bus interface I/O bridge Main memory USB controller Graphics adapter I/O bus Disk controller Expansion slots for other devices such as network adapters. Mouse Keyboard Monitor Disk 28

Reading a Disk Sector (1) CPU chip Register file ALU CPU initiates a disk read by writing a command, logical block number, and destination memory address to a port (address) associated with disk controller. Bus interface Main memory I/O bus USB controller Graphics adapter Disk controller mouse keyboard Monitor Disk 29

Reading a Disk Sector (2) CPU chip Register file ALU Disk controller reads the sector and performs a direct memory access (DMA) transfer into main memory. Bus interface Main memory I/O bus USB controller Graphics adapter Disk controller Mouse Keyboard Monitor Disk CSE 153 Lecture 20 File Systems 30

Reading a Disk Sector (3) CPU chip Register file ALU When the DMA transfer completes, the disk controller notifies the CPU with an interrupt (i.e., asserts a special interrupt pin on the CPU) Bus interface Main memory I/O bus USB controller Graphics adapter Disk controller Mouse Keyboard Monitor Disk CSE 153 Lecture 20 File Systems 31

Disk Interaction Specifying disk requests requires a lot of info: Cylinder #, surface #, track #, sector #, transfer size Older disks required the OS to specify all of this The OS needed to know all disk parameters Modern disks are more complicated Not all sectors are the same size, sectors are remapped, etc. Current disks provide a higher-level interface (SCSI) The disk exports its data as a logical array of blocks [0 N]» Disk maps logical blocks to cylinder/surface/track/sector Only need to specify the logical block # to read/write But now the disk parameters are hidden from the OS CSE 153 Lecture 20 File Systems 32

Disks Heterogeneity Seagate Barracuda 3.5" (workstation) capacity: 250-750 GB rotational speed: 7,200 RPM sequential read performance: 78 MB/s (outer) - 44 MB/s (inner) seek time (average): 8.1 ms Seagate Cheetah 3.5" (server) capacity: 73-300 GB rotational speed: 15,000 RPM sequential read performance: 135 MB/s (outer) - 82 MB/s (inner) seek time (average): 3.8 ms Seagate Savvio 2.5" (smaller form factor) capacity: 73 GB rotational speed: 10,000 RPM sequential read performance: 62 MB/s (outer) - 42 MB/s (inner) seek time (average): 4.3 ms CSE 153 Lecture 20 File Systems 33

Recent: Seagate Enterprise (2015) 10TB! 800 Gbits/inch 2 7 (3.5 ) platters, 2 heads each 7200 RPM, 8ms seek latency 249/225 MB/sec read/write transfer rates 2.5million hours MTBF 256MB cache MSRP ~$500 CSE 153 Lecture 20 File Systems 34

Storage Performance & Price Bandwidth (sequential R/W) Cost/GB Size HHD 50-100 MB/s $0.05-0.1/GB 2-4 TB SSD 1 200-500 MB/s (SATA) 6 GB/s (PCI) $1.5-5/GB 200GB-1TB DRAM 10-16 GB/s $5-10/GB 64GB-256GB 1 http://www.fastestssd.com/featured/ssd-rankings-the-fastest-solid-state-drives/ BW: SSD up to x10 than HDD, DRAM > x10 than SSD Price: HDD x30 less than SSD, SSD x4 less than DRAM 35 CSE 153 Lecture 20 File Systems

Contrarian View A lot of file system ideas tied to disk drives are no CSE 153 Lecture 20 File Systems 36 longer relevant?

60 TB SSD ($20,000) CSE 153 Lecture 20 File Systems 37

Disk Scheduling Because seeks are so expensive (milliseconds!), OS schedules requests that are queued waiting for the disk FCFS (do nothing)» Reasonable when load is low» Does nothing to minimize overhead of seeks SSTF (shortest seek time first)» Minimize arm movement (seek time), maximize request rate» Favors middle blocks, potential starvation of blocks at ends SCAN (elevator)» Service requests in one direction until done, then reverse» Long waiting times for blocks at ends C-SCAN» Like SCAN, but only go in one direction (typewriter) CSE 153 Lecture 20 File Systems 38

Disk Scheduling (2) In general, unless there are request queues, disk scheduling does not have much impact Important for servers, less so for PCs Modern disks often do the disk scheduling themselves Disks know their layout better than OS, can optimize better Ignores, undoes any scheduling done by OS CSE 153 Lecture 20 File Systems 39