I/O Systems and Storage Devices

Similar documents
I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

Module 13: Secondary-Storage Structure

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Chapter 10: Mass-Storage Systems

Disk Scheduling. Based on the slides supporting the text

Disk Scheduling. Chapter 14 Based on the slides supporting the text and B.Ramamurthy s slides from Spring 2001

Chapter 14: Mass-Storage Systems. Disk Structure

CSE325 Principles of Operating Systems. Mass-Storage Systems. David P. Duggan. April 19, 2011

V. Mass Storage Systems

CS420: Operating Systems. Mass Storage Structure

Chapter 12: Secondary-Storage Structure. Operating System Concepts 8 th Edition,

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

Overview of Mass Storage Structure

CS3600 SYSTEMS AND NETWORKS

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

Chapter 13: Mass-Storage Systems. Disk Scheduling. Disk Scheduling (Cont.) Disk Structure FCFS. Moving-Head Disk Mechanism

Chapter 13: Mass-Storage Systems. Disk Structure

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

Mass-Storage Structure

Chapter 10: Mass-Storage Systems

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

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

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

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

EIDE, ATA, SATA, USB,

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

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

Free Space Management

Lecture 9. I/O Management and Disk Scheduling Algorithms

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

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

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management

Chapter 12: Mass-Storage

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Operating Systems 2010/2011

Main Points of the Computer Organization and System Software Module

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

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

Basic Memory Management

Disc Allocation and Disc Arm Scheduling?

CSCI-GA Operating Systems. I/O : Disk Scheduling and RAID. Hubertus Franke

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

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

Chapter 10: Mass-Storage Systems

CSE 380 Computer Operating Systems

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

CSE380 - Operating Systems. Communicating with Devices

CS370 Operating Systems

Principles of Operating Systems CS 446/646

Mass-Storage Structure

Lecture 21 Disk Devices and Timers

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

Silberschatz, et al. Topics based on Chapter 13

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

I/O Management and Disk Scheduling. Chapter 11

CHAPTER 12 AND 13 - MASS-STORAGE STRUCTURE & I/O- SYSTEMS

Module 13: Secondary-Storage

CSC Operating Systems Spring Lecture - XIX Storage and I/O - II. Tevfik Koşar. Louisiana State University.

RAID Structure. RAID Levels. RAID (cont) RAID (0 + 1) and (1 + 0) Tevfik Koşar. Hierarchical Storage Management (HSM)

Chapter 14: Mass-Storage Systems

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

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

Chapter 11 I/O Management and Disk Scheduling

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

Part IV I/O System. Chapter 12: Mass Storage Structure

Principles of Operating Systems CS 446/646

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

Mass-Storage Systems. Mass-Storage Systems. Disk Attachment. Disk Attachment

More on Synchronization and Deadlock

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring

Outline. Operating Systems: Devices and I/O p. 1/18

Course Description: This course includes the basic concepts of operating system

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

Hard Disk Drives (HDDs)

Part IV I/O System Chapter 1 2: 12: Mass S torage Storage Structur Structur Fall 2010

CS370 Operating Systems

Tape pictures. CSE 30341: Operating Systems Principles

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

Lecture 23: Storage Systems. Topics: disk access, bus design, evaluation metrics, RAID (Sections )

UNIT 4 Device Management

UNIT-7. Overview of Mass Storage Structure

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

Chapter 11. I/O Management and Disk Scheduling

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

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition

Chapter 11: Mass-Storage Systems

Today: Secondary Storage! Typical Disk Parameters!

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

Mass-Storage. ICS332 Operating Systems

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

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

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?

STORAGE SYSTEMS. Operating Systems 2015 Spring by Euiseong Seo

MASS-STORAGE STRUCTURE

Transcription:

CSC 256/456: Operating Systems I/O Systems and Storage Devices John Criswell! University of Rochester 1

I/O Device Controllers I/O devices have both mechanical component & electronic component! The electronic component is the device controller! It contains control logic, command registers, status registers, and onboard buffer space 2

Device-Controller-Software Relationship Application User Mode Software High-Level OS Kernel Component Kernel Mode Software Device Driver Device Controller Device Hardware 3

I/O Ports & Memory-Mapped I/O Separate I/O and memory space! Special I/O commands (e.g., IN/OUT)! Memory-mapped I/O 4

How is I/O accomplished? Polling-based! CPU spins and polls the I/O until it completes! Periodic polling! Continuous polling consumes too much CPU! Instead, we poll periodically - saving CPU overhead, may not react immediately to hardware events! Interrupt-driven! CPU initiates I/O and then does something else! CPU notified when the I/O is done (interrupts) 5

Interrupt Handlers 1. Save registers of the old process! 2. Set up context for interrupt service procedure! 1. Switch from user space to kernel space: MMU, stack,! 3. Run service procedure; when safe, re-enable interrupts! 4. Run scheduler to choose the new process to run next! 5. Set up context (MMU, registers) for process to run next! 6. Start running the new process 6

Cost What is the cost? Is it a big deal?!! For Gigabit Ethernet, each packet arrives once every 12us. 7

How could you speed up interrupt handling? 8

Speeding Up Interrupt Handling Let OS share address space with application! No TLB flushes since page table remains the same! Shadow registers! Lazily save processor state! Floating point registers! Vector registers! Debug registers 9

Interrupt Vectors Intel Pentium processor event-vector table! 0: divide by zero! 6: invalid opcode! 11: segment not present! 12: stack fault! 14: page fault! 31: non-maskable! 32-255: maskable interrupts 10

Which core gets an interrupt? 11

Advanced Programmable Interrupt Controller (APIC) Local APIC! CPU CPU Timer interrupt! I/O APIC! Local APIC Local APIC Routes interrupts to different processors! Balances interrupts among different processors I/O APIC To I/O Bus 12

Device Driver Reliability Device driver is the device-specific part of the kernelspace I/O software; it also includes interrupt handlers! Device drivers must run in kernel mode! Device driver crash brings down whole system! Device drivers are probably the buggiest part of the OS 13

How could we make systems more reliable if device drivers continue to be buggy? 14

Improving Device Driver Reliability Run most of the device driver code at user level! What is the cost?! Restrict and limit device driver operations in the kernel! Separate address space via MMU! Compiler instrumentation (XFI)! Type-safe programming languages 15

To the disk drive, Robin! 16

Disk Drive Mechanical Parts Track Cylinder! (set of tracks) Sector Multi-surface Disk Disk Surface Cylinders 17

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. Cylinder! (set of tracks) 18

Disk Performance Characteristics A disk operation has three major components! Seek moving the heads to the cylinder containing the desired sector! Rotation rotating the desired sector to the disk head! Transfer sequentially moving data to or from disk Seek time (millisecond) Transfer throughput (MB/sec) 12 10 8 6 4 2 0 60 40 20 0 Seek distance Seek time (millisecond) A Seagate SCSI drive An IBM SCSI drive Starting transfer address Read throughput (MB/sec) 19

FCFS (First-Come-First-Serve) Illustration shows the total head movement is 640.! Starvation? 20

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.! Illustration shows the total head movement is 236. 21

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, where the head movement is reversed and servicing continues.! Sometimes called the elevator algorithm.! Illustration shows the total head movement is 208. 22

SCAN Disk arm moves back and forth along disk! Reads data as it goes! Sometimes called the elevator algorithm.! Illustration shows the total head movement is 208. 23

C-SCAN (Circular-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. 24

C-LOOK Variation 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. 25

Deadline Scheduling in Linux A regular elevator-style scheduler similar to C-LOOK! Additionally, all I/O requests are put into a FIFO queue with an expiration time (e.g., 500ms)! When the head request in the FIFO queue expires, it will be executed next (even if it is not next in line according to C-LOOK).! A mix of performance and fairness. 26

RAIDers of the Lost Data 27

Disk Concurrency The only thing better than one guitar is two guitars.! Maurice Ravel! The only thing better than one disk is two disks.! David Patterson, Garth A. Bison, and Randy Katz 28

Two Disks: Disk Striping Blocks divided into subblocks! Subblocks stored on different disks Disk 1 Disk 2 CPU 29

Two Disks: Mirroring Make a copy of each block on each disk! Provides redundancy Disk 1 Disk 2 CPU 30

Multiple Disks: Parity Block Have one disk contain parity bits of blocks on other devices! Provides redundancy without full copy Disk 1 Disk 2 Disk 3 CPU 31

Exploiting Concurrency RAID: Redundant Arrays of Independent Disks! RAID 0: data striping at block level, no redundancy! RAID 1: mirrored disks (100% overhead)! RAID 2: bit-level striping with parity bits, synchronized writes! RAID 3: data striping at the bit level with parity disk, synchronized writes! RAID 4: data striping at block level with parity disk! RAID 5: scattered parity! RAID 6: handles multiple disk failures 32

Disk Management Formatting! Header: sector number etc.! Footer/tail: ECC codes! Gap! Initialize mapping from logical block number to defect-free sectors! Logical disk partitioning! One or more groups of cylinders! Sector 0: master boot record loaded by BIOS firmware, which contains partition information! Boot record points to boot partition 33

Swap Space Management Part of file system?! Requires navigating directory structure! Disk allocation data structures! Separate disk partition! No file system or directory structure! Optimize for speed rather than storage efficiency! When is swap space created? 34

Credits Parts of the lecture slides contain original work of Abraham Silberschatz, Peter B. Galvin, Greg Gagne, Andrew S. Tanenbaum, and Gary Nutt. The slides are intended for the sole purpose of instruction of operating systems at the University of Rochester. All copyrighted materials belong to their original owner(s). 35