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

Similar documents
Module 12: I/O Systems

Chapter 13: I/O Systems

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

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

Module 12: I/O Systems

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Chapter 13: I/O Systems

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

Lecture 13 Input/Output (I/O) Systems (chapter 13)

Chapter 13: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems

Chapter 13: I/O Systems

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

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Chapter 13: I/O Systems

I/O Systems. 04/16/2007 CSCI 315 Operating Systems Design 1

The control of I/O devices is a major concern for OS designers

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

Input/Output Systems

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Silberschatz and Galvin Chapter 12

Chapter 13: I/O Systems

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

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

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018

CSE 451: Operating Systems Spring Module 12 Secondary Storage

COT 4600 Operating Systems Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM

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

Chapter 13: I/O Systems

操作系统概念 13. I/O Systems

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

Lecture 15: I/O Devices & Drivers

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

STORAGE SYSTEMS. Operating Systems 2015 Spring by Euiseong Seo

Hard Disk Drives (HDDs)

Module 11: I/O Systems

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

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

UNIT-7. Overview of Mass Storage Structure

Input/Output Systems

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

I/O SYSTEMS. Sunu Wibirama

Operating Systems. Operating Systems Professor Sina Meraji U of T

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)

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

CSE 153 Design of Operating Systems Fall 2018

Operating Systems 2010/2011

[08] IO SUBSYSTEM 1. 1

CSE 153 Design of Operating Systems

Chapter 7: Mass-storage structure & I/O systems. Operating System Concepts 8 th Edition,

CS420: Operating Systems. Kernel I/O Subsystem

NWI-IBC019: Operating systems

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

Input/Output Management

Input Output (IO) Management

VIII. Input/Output Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term

Input-Output (I/O) Input - Output. I/O Devices. I/O Devices. I/O Devices. I/O Devices. operating system must control all I/O devices.

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

I/O Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CS370 Operating Systems

CS420: Operating Systems. Mass Storage Structure

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

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

CS370 Operating Systems

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

Comp 204: Computer Systems and Their Implementation. Lecture 18: Devices

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

I/O Systems. Jo, Heeseung

Devices. Today. Comp 104: Operating Systems Concepts. Operating System An Abstract View 05/01/2017. Devices. Devices

I/O Management and Disk Scheduling. Chapter 11

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

Mass-Storage Structure

Operating Systems. Steven Hand. Michaelmas / Lent Term 2008/ lectures for CST IA. Handout 4. Operating Systems

Operating Systems 2010/2011

Today: I/O Systems. Architecture of I/O Systems

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Operating Systems. V. Input / Output

Chapter 11. I/O Management and Disk Scheduling

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

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

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

-Device. -Physical or virtual thing that does something -Software + hardware to operate a device (Controller runs port, Bus, device)

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done)

I/O. CS 416: Operating Systems Design Department of Computer Science Rutgers University

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

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?

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Answer to exercises chap 13.2

CS330: Operating System and Lab. (Spring 2006) I/O Systems

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

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

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

Disk Scheduling COMPSCI 386

Transcription:

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

Part 1 - Secondary Storage Secondary storage typically: is anything that is outside of primary memory does not permit direct execution of instructions or data retrieval via machine load/store instructions Characteristics: it s large: 30-60GB it s cheap: 40GB ~ 130. 0.3 cents per megabyte (wow!) it s persistent: data survives power loss it s slow: milliseconds to access why is this slow?? Applied Operating System Concepts 12.2

Typical time for computer components Item Processor cycle Time 0.5 [ns] (2 GHz) Scaled to human terms (2 billion times slower) 1 second Cache access 1 ns (1 GHz) 2 seconds Memory access 15 60 ns 30 sec 2min Context Switch Disk access 5,000 ns (5 usec) 7,000,000 ns (7 ms) ~3 hrs (167 mins) 51/2 months (162 days) Quantum 100,000,000 ns (100 ms) 6.3 years 1 ns = 10-9 seconds 1 usec = 10-6 seconds Applied Operating System Concepts 12.3

Size and Access Time Applied Operating System Concepts 12.4

Disks and the OS Disks are messy devices errors, bad blocks, missed seeks, etc. Job of OS is to hide this mess from higher-level software low-level device drivers (initiate a disk read, etc.) higher-level abstractions (files, databases, etc.) OS may provide different levels of disk access to different clients physical disk block (surface, cylinder, sector) disk logical block (disk block #) file logical (filename, block or record or byte #) Applied Operating System Concepts 12.5

Physical Disk Structure IBM Ultrastar 36XP drive form factor: 3.5 capacity: 36.4 GB rotation rate: 7,200 RPM (120 RPS) platters: 10 surfaces: 20 sector size: 512 to 732 bytes cylinders: 11,494 cache: 4MB transfer rate: 17.9 MB/s (inner) 28.9 MB/s (outer) full seek: 14.5 ms head switch: 0.3 ms Applied Operating System Concepts 12.6

Platter Applied Operating System Concepts 12.7

Interacting with Disks In the old days OS would have to specify cylinder #, sector #, surface #, transfer size I.e., OS needs to know all of the disk parameters Modern disks are even more complicated not all sectors are the same size, sectors are remapped, disk provides a higher-level interface, e.g. SCSI exports data as a logical array of blocks [0 N] maps logical blocks to cylinder/surface/sector OS only needs to name logical block #, disk maps this to cylinder/surface/sector as a result, physical parameters are hidden from OS both good and bad Applied Operating System Concepts 12.8

Disk Performance Performance depends on a number of steps seek: moving the disk arm to the correct cylinder depends on how fast disk arm can move seek times aren t diminishing very quickly rotation: waiting for the sector to rotate under head depends on rotation rate of disk rates are increasing, but slowly transfer: transferring data from surface into disk controller, and from there sending it back to host depends on density of bytes on disk increasing, and very quickly When the OS uses the disk, it tries to minimize the cost of all of these steps particularly seeks and rotation Applied Operating System Concepts 12.9

Disk Scheduling (1) Seeks are very expensive, so the OS attempts to schedule disk requests that are queued waiting for the disk FCFS (do nothing) reasonable when load is low long waiting time for long request queues * requests served in order of arrival * simplest and fairest policy * works well when few processes, each accessing sectors that are clustered together * poor when many processes compete for access to disk SSTF (shortest seek time first) minimize arm movement (seek time), maximize request rate unfairly favors middle blocks * scheduler needs to know current track position * chooses request involving nearest track => method for tie-breaking also needs to be adopted * not optimal, but likely to be better than FIFO * starvation problem Applied Operating System Concepts 12.10

Disk Scheduling (2) SCAN (elevator algorithm) arm moves in one direction only until it reaches last track (or until no further requests in that direction, also known as LOOK), servicing requests as it goes * reverses direction after each scan * no starvation * upon reversal, tracks with highest density of requests likely to be furthest away! skews wait times non-uniformly C-SCAN like scan, but only go in one direction (typewriter) uniform wait times arm flies back to beginning instead of reversing direction upon reaching last track or no further requests in that direction (C- LOOK) Applied Operating System Concepts 12.11

Head Movement Current position: track 100 Requested tracks ( in order received) 55, 58, 39, 18, 90, 160, 150, 38, 184 FIFO: move 45 tracks to track 55; move 3 tracks to track 58; etc. SSTF: move 10 tracks to track 90; move 32 tracks to track 58; etc. SCAN, C-SCAN (moving in direction of increasing track number): move 50 tracks to track 150; move 10 tracks to track 160; etc. Applied Operating System Concepts 12.12

Part 2 - I/O Subsystems I/O hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Performance Applied Operating System Concepts 12.13

I/O Hardware Incredible variety of I/O devices Common concepts Port Bus (daisy chain or shared direct access) Controller (host adapter) I/O instructions control devices Devices have addresses, used by Direct I/O instructions Memory-mapped I/O Applied Operating System Concepts 12.14

Polling Determines state of device command-ready busy error Busy-wait cycle to wait for I/O from device Applied Operating System Concepts 12.15

Interrupts CPU Interrupt request line triggered by I/O device Interrupt handler receives interrupts Maskable to ignore or delay some interrupts Interrupt vector to dispatch interrupt to correct handler Based on priority Some unmaskable Interrupt mechanism also used for exceptions Applied Operating System Concepts 12.16

Interrupt-driven I/O Cycle Applied Operating System Concepts 12.17

Direct Memory Access Used to avoid programmed I/O for large data movement Requires DMA controller Bypasses CPU to transfer data directly between I/O device and memory Applied Operating System Concepts 12.18

Six step process to perform DMA transfer Applied Operating System Concepts 12.19

Application I/O Interface I/O system calls encapsulate device behaviors in generic classes Device-driver layer hides differences among I/O controllers from kernel Devices vary in many dimensions Character-stream or block Sequential or random-access Sharable or dedicated Speed of operation read-write, read only, or write only Applied Operating System Concepts 12.20

Block and Character Devices Block devices include disk drives Commands include read, write, seek Raw I/O or file-system access Memory-mapped file access possible Character devices include keyboards, mice, serial ports Commands include get, put Libraries layered on top allow line editing Applied Operating System Concepts 12.21

Network Devices Varying enough from block and character to have own interface Unix and Windows/NT include socket interface Separates network protocol from network operation Includes select functionality Approaches vary widely (pipes, FIFOs, streams, queues, mailboxes) Applied Operating System Concepts 12.22

Clocks and Timers Provide current time, elapsed time, timer if programmable interval time used for timings, periodic interrupts ioctl (on UNIX) covers odd aspects of I/O such as clocks and timers Applied Operating System Concepts 12.23

Blocking and Nonblocking I/O Blocking - process suspended until I/O completed Easy to use and understand Insufficient for some needs Nonblocking - I/O call returns as much as available User interface, data copy (buffered I/O) Implemented via multi-threading Returns quickly with count of bytes read or written Asynchronous - process runs while I/O executes Difficult to use I/O subsystem signals process when I/O completed Applied Operating System Concepts 12.24

Kernel I/O Subsystem Scheduling Some I/O request ordering via per-device queue Some OSs try fairness Buffering - store data in memory while transferring between devices To cope with device speed mismatch To cope with device transfer size mismatch To maintain copy semantics Applied Operating System Concepts 12.25

Kernel I/O Subsystem Caching - fast memory holding copy of data Always just a copy Key to performance Spooling - hold output for a device If device can serve only one request at a time i.e., Printing Device reservation - provides exclusive access to a device System calls for allocation and deallocation Watch out for deadlock Applied Operating System Concepts 12.26

Error Handling OS can recover from disk read, device unavailable, transient write failures Most return an error number or code when I/O request fails System error logs hold problem reports Applied Operating System Concepts 12.27

Kernel Data Structures Kernel keeps state info for I/O components, including open file tables, network connections, character device state Many, many complex data structures to track buffers, memory allocation, dirty blocks Some use object-oriented methods and message passing to implement I/O Applied Operating System Concepts 12.28

I/O Requests to Hardware Operations Consider reading a file from disk for a process Determine device holding file Translate name to device representation Physically read data from disk into buffer Make data available to requesting process Return control to process Applied Operating System Concepts 12.29

Life Cycle of an I/O Request Applied Operating System Concepts 12.30

Performance I/O a major factor in system performance Demands CPU to execute device driver, kernel I/O code Context switches due to interrupts Data copying Network traffic especially stressful Applied Operating System Concepts 12.31

Intercomputer communications Applied Operating System Concepts 12.32

Improving Performance Reduce number of context switches Reduce data copying Reduce interrupts by using large transfers, smart controllers, polling Use DMA Balance CPU, memory, bus, and I/O performance for highest throughput Applied Operating System Concepts 12.33