11: I/O Device Management



Similar documents
Chapter 11 I/O Management and Disk Scheduling

Devices and Device Controllers

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Have both hardware and software. Want to hide the details from the programmer (user).

Storage and File Systems. Chester Rebeiro IIT Madras

Computer Systems Structure Input/Output

Chapter Introduction. Storage and Other I/O Topics. p. 570( 頁 585) Fig I/O devices can be characterized by. I/O bus connections

Chapter 9: Peripheral Devices: Magnetic Disks

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Chapter 11 I/O Management and Disk Scheduling

Communicating with devices

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

Sistemas Operativos: Input/Output Disks

Introduction to I/O and Disk Management

Chapter 10: Mass-Storage Systems

Chapter 12: Mass-Storage Systems

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

I/O. Input/Output. Types of devices. Interface. Computer hardware

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

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

Operating System Concepts. Operating System 資 訊 工 程 學 系 袁 賢 銘 老 師

Disks and RAID. Profs. Bracy and Van Renesse. based on slides by Prof. Sirer

1. Computer System Structure and Components

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

Linux Driver Devices. Why, When, Which, How?

What is involved in input/output? How does the operating system manage I/O?

Chapter 5 Busses, Ports and Connecting Peripherals

Chapter 1 Lesson 3 Hardware Elements in the Embedded Systems Chapter-1L03: "Embedded Systems - ", Raj Kamal, Publs.: McGraw-Hill Education

Storage. The text highlighted in green in these slides contain external hyperlinks. 1 / 14

Input/output (I/O) I/O devices. Performance aspects. CS/COE1541: Intro. to Computer Architecture. Input/output subsystem.

Computer Organization & Architecture Lecture #19

Lecture 16: Storage Devices

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

Price/performance Modern Memory Hierarchy

Hard Disk Drives and RAID

Operating Systems 4 th Class

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Big Picture. IC220 Set #11: Storage and I/O I/O. Outline. Important but neglected

The Bus (PCI and PCI-Express)

Distribution One Server Requirements

Serial Communications

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

1 Storage Devices Summary

Computer-System Architecture

Dependable Systems. 9. Redundant arrays of. Prof. Dr. Miroslaw Malek. Wintersemester 2004/05

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

Overview and History of Operating Systems

Storing Data: Disks and Files

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Input / Ouput devices. I/O Chapter 8. Goals & Constraints. Measures of Performance. Anatomy of a Disk Drive. Introduction - 8.1

Optimizing LTO Backup Performance

Q & A From Hitachi Data Systems WebTech Presentation:

INPUT/OUTPUT ORGANIZATION

Ways to Use USB in Embedded Systems

Computer Architecture Prof. Mainak Chaudhuri Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

H ARDWARE C ONSIDERATIONS

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

760 Veterans Circle, Warminster, PA Technical Proposal. Submitted by: ACT/Technico 760 Veterans Circle Warminster, PA

Outline. Database Management and Tuning. Overview. Hardware Tuning. Johann Gamper. Unit 12

Chapter 3 Operating-System Structures

Network Attached Storage. Jinfeng Yang Oct/19/2015

William Stallings Computer Organization and Architecture 7 th Edition. Chapter 6 External Memory

Timing of a Disk I/O Transfer

Virtual Machines. COMP 3361: Operating Systems I Winter

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

CSC 2405: Computer Systems II

Outline: Operating Systems

Primary Memory. Input Units CPU (Central Processing Unit)

AirWave 7.7. Server Sizing Guide

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 13-1

I/O Device and Drivers

Chapter 3: Computer Hardware Components: CPU, Memory, and I/O

Overview of Operating Systems Instructor: Dr. Tongping Liu

Terminal Server Software and Hardware Requirements. Terminal Server. Software and Hardware Requirements. Datacolor Match Pigment Datacolor Tools

Read this before starting!

Windows Server Performance Monitoring

Chapter 13 Disk Storage, Basic File Structures, and Hashing.

Chapter 12: Secondary-Storage Structure

Operating System Tutorial

Floppy Drive & Hard Drive

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Lecture 9: Memory and Storage Technologies

Chapter 02: Computer Organization. Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Taking Linux File and Storage Systems into the Future. Ric Wheeler Director Kernel File and Storage Team Red Hat, Incorporated

Introduction. What is an Operating System?

Chapter 13. Disk Storage, Basic File Structures, and Hashing

An Implementation Of Multiprocessor Linux

IDE/ATA Interface. Objectives. IDE Interface. IDE Interface

4.2: Multimedia File Systems Traditional File Systems. Multimedia File Systems. Multimedia File Systems. Disk Scheduling

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

DEVICE DRIVERS AND TERRUPTS SERVICE MECHANISM Lesson-14: Device types, Physical and Virtual device functions

Virtuoso and Database Scalability

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

Transcription:

CSC400 - Operating Systems 11: I/O Device Management J. Sumey Introduction Another important function & major part of the OS (I/O drivers) is the control of the computer s I/O devices including: issue commands to the device catch & process interrupts from the device handle errors Goal: to provide an interface between the hardware of the device and the rest of the system in a manner that provides as much device independence as possible. CSC400 - I/O Device Management 2 CSC400 - Operating Systems 1

I/O Device Categories Human readable communicate with enduser keyboard, mouse, display Machine readable communicate with electronic components drives, devices controllers, sensors/actuators Communication communicate with remote devices/systems modems, NICs CSC400 - I/O Device Management 3 I/O Considerations Data rate of data transfers Application affects the way OS deals with device Control complexity from simple printers to sophisticated disks Unit of transfer byte/chars, blocks/packets Data representation data encoding, parity/error check, etc Error handling detection, consequences, etc. CSC400 - I/O Device Management 4 CSC400 - Operating Systems 2

I/O Data Rate Diversity CSC400 - I/O Device Management 5 I/O Hardware Review CSC400 - Operating Systems 3

I/O Device Models Character data transfer is performed char/byte at a time not addressable, no seek operation Block data transfer performed in fixed-sized blocks is addressable, has seek capability Network variable sized block transfers, but not addressable CSC400 - I/O Device Management 7 Device Controllers the actual interface to an I/O device, typically implemented in Integrated Circuit (IC) form on an adapter board or directly on the motherboard converts between raw I/O data format (ex: serial bit stream) and blocks of bytes performs error detection and possibly error correction may use an industry standard (ex: IDE, SCSI, SATA, USB) or a proprietary interface to the I/O hardware implements I/O ports (registers) using either memorymapped or I/O mapped I/O contains internal I/O buffer to solve timing mismatches between CPU & I/O device may also have ability to send interrupt requests (IRQs) to the CPU for more efficient I/O control I/O drivers always deal with the controller, not the actual I/O device CSC400 - I/O Device Management 8 CSC400 - Operating Systems 4

I/O Data Transfer Methods how is data moved between main memory and the I/O interface? Programmed I/O: CPU is programmed to transfer each byte individually in a load/store loop Interrupt I/O: controller signals CPU asynchronously when attention is needed improvement over programmed I/O by eliminating busywait Direct Memory Access (DMA): I/O controller is able to read/write main memory directly without CPU intervention, then sends IRQ upon completion of I/O task allows CPU to perform other useful work (ie: other tasks!) during I/O operation CSC400 - I/O Device Management 9 I/O Controller w/ DMAC system CPU programs DMAC for I/O operation DMAC controls system buses during I/O for direct transfers when done, DMAC sends interrupt to system CPU CSC400 - I/O Device Management 10 CSC400 - Operating Systems 5

DMA/Bus Configurations single bus: I/O bus: CSC400 - I/O Device Management 11 I/O Software I/O device programming, can be an intense but doable process if divided into functional layers CSC400 - Operating Systems 6

I/O Software Goals provide device independence user programs should not be concerned with internal device differences uniform naming for device access ex: "/dev" pathnames in Unix error handling / recovery as close as possible to hardware, isolate user if possible I/O synchronization: sync. or async. a CPU efficiency issue device sharing can device be used by only 1 or more than 1 concurrent process? CSC400 - I/O Device Management 13 Layered Implementation organize the software into welldefined layers upper layers provide a clean, regular user interface to device as a logical resource lower layers concerned with actual I/O hardware, instructions, and control typical organization: 1. interrupt handler (ISR) 2. device driver proper 3. device independent software 4. user-space software CSC400 - I/O Device Management 14 CSC400 - Operating Systems 7

Interrupt Handler (ISR) lowest-level of device driver quickly responds to CPU attention requests from I/O controller performs data transfer if needed but minimal processing unblocks process that initiated the I/O request move from blocked to ready queue CSC400 - I/O Device Management 15 Device Driver the device dependent code needed to control one device type or class of devices accepts abstract requests from above layers and issues proper commands to the controller ex: reading a disk block tracks controller status & handles errors if possible may either complete I/O request without delay or block returns status info to above layer CSC400 - I/O Device Management 16 CSC400 - Operating Systems 8

Device Independent Software bulk of I/O software, provides a number of functions to user-level software: uniform interface: open-read-write-close model device naming; special pathnames or reserved names, ex: /dev/fd0 protection / access permissions buffering & data transfer via consistent block size device allocation & concurrency issues error handling special feature support: ioctl() on Linux: #include <sys/ioctl.h> CSC400 - I/O Device Management 17 User-space Software routines & data structures provided via libraries & linked together with user programs either statically or dynamically ex: fopen(), printf(), scanf() CSC400 - I/O Device Management 18 CSC400 - Operating Systems 9

I/O Buffering used to solve timing mismatch issues fast CPUs and slow I/O devices or vice-versa! types: stream-oriented, i.e. byte-at-a-time printers, comm ports, terminals/mice (non-storage) block-oriented USB devices, network, disks CSC400 - I/O Device Management 19 No Buffer OS moves data directly between I/O device and user process can result in data loss CSC400 - I/O Device Management 20 CSC400 - Operating Systems 10

Single Buffer OS maintains a [kernel] memory buffer for I/O data must implement mutual exclusion CSC400 - I/O Device Management 21 Double Buffered OS and process alternates between pair of buffers can support concurrent data movement! CSC400 - I/O Device Management 22 CSC400 - Operating Systems 11

Circular Buffers more than 2 buffers with wrap around can also handle I/O bursts CSC400 - I/O Device Management 23 I/O Drivers CSC400 - Operating Systems 12

Driver Classes modern OSs provide support for many different I/O devices Unix/Linux ex: RAM: /dev/mem, /dev/kmem, /dev/null disk drives: /dev/dsk/*, /dev/rdsk/* console: /dev/kbd, /dev/mouse, /dev/fb* printers: /dev/lp* terminals: /dev/tty* CSC400 - I/O Device Management 25 Sample Driver Case Studies system clock/timer driver terminal / communication drivers disk / storage drivers CSC400 - I/O Device Management 26 CSC400 - Operating Systems 13

Clock / Timer Driver used for timing related functions, no real I/O hardware consists of crystal oscillator (time reference), a counter (clocked by oscillator), and a holding register (used to initialize counter) ex: every IBM compatible PC includes a 14.3 MHz timebase & interrupt hardware (PIT) CPU interrupt is generated when counter decrements to zero, then counter is reloaded from holding register CSC400 - I/O Device Management 27 Clock / Timer Driver - 2 in response to clock interrupt, the clock driver acknowledges the interrupt and performs appropriate functions: maintain time of day via ticks/seconds, etc. implement quantum counter & calls scheduler when quantum expires CPU accounting, process runtimes, etc. process alarms via multiple virtual clocks & signals (for user processes) watchdog timers & function callbacks (for OS) on Linux: see rtc(4) CSC400 - I/O Device Management 28 CSC400 - Operating Systems 14

Terminal Drivers a primary task of the terminal driver is to hide differences in the vast number & types of terminals 3 categories of terminals: memory-mapped: part of computer itself (console) contains video controller & video RAM, generates frames of pixels on screen may be character-mapped or bit-mapped includes system keyboard for input dumb or smart terminals connected via serial line (RS-232) bit-serial transmission using UARTs and 3 wire link often referred to as ttys from the old Teletype days terminal emulators connected via Ethernet PC or other computer running terminal emulation software (NetTerm, PuTTY, etc.) X terminal: modern-day high performance computer running bitmapped display via X window system CSC400 - I/O Device Management 29 Terminal Drivers - 2 terminal Input software (keyboard driver): can operate in either character-oriented or line-oriented mode canonical (cooked) vs. noncanonical (raw) mode provides buffer for line-oriented input may support code pages to map keycodes to proper keystrokes according to locale (ex: ASCII) typically does not provide echoing terminal Output software (frame buffer driver): operation depends on whether screen is memory-mapped or serial terminal usually supports ANSI escape sequences for control functions ex: ESC[2J = clear screen / home cursor ref: http://wikipedia.org/wiki/ansi_escape_code CSC400 - I/O Device Management 30 CSC400 - Operating Systems 15

Magnetic Disk (disc) Drives invented by IBM in 1957 as a faster alternative to magnetic tape drastically improved in performance and decreased in cost over the decades from $10k/MB to < 10 /GB arranged into platters on a spindle, each side into tracks, tracks into sectors cylinder = given track number on all sides ref: http://en.wikipedia.org/wiki/hard_disk_drive CSC400 - I/O Device Management 31 Disk Drives - 2 read/write heads mounted on an actuator, "flies" over the cylinders 1 head / side seek = positioning heads over given cyl. on-board embedded controller: all control functions physical hard drive geometry data compression (RLL) error detection (CRC) / handling implements interface (ATA, SATA, SCSI, Fiber) CSC400 - I/O Device Management 32 CSC400 - Operating Systems 16

Disk Access Time disk block read/write time is determined by 3 factors: head seek time to correct cylinder 4..15 ms/cyl.! rotational delay for correct sector to appear under head 3~6 ms/rotation data transfer time for actual data bytes to transfer thru head/electronics ~1 Mbits/sec CSC400 - I/O Device Management 33 Disk Drivers because of the disk drive latencies, disk drivers for hi-performance OSs must incorporate disk arm scheduling for each drive! attempt to optimize drive usage maximize throughput (requests) minimize response (wait) time minimize response time variance CSC400 - I/O Device Management 34 CSC400 - Operating Systems 17

Disk Scheduling Strategies - 1 FCFS service requests as received no optimization, inefficient but fair SSTF (Shortest-Seek-Time-First) higher throughput than FCFS poor service to tracks far from middle, may result in starvation / indef. postponement CSC400 - I/O Device Management 35 Disk Scheduling Strategies - 2 SCAN (elevator) maintains a preferred direction (in/out) & services all pending requests in current direction before switching better than FCFS without starvation of SSTF C-SCAN (circular SCAN) modification to SCAN when requests are only serviced in 1 direction avoids discrimination against "far out" cyls. CSC400 - I/O Device Management 36 CSC400 - Operating Systems 18

Disk Performance - 1 caching in disk driver reserved in main memory write-back: defers disk writes into "batches", actually written at periodic intervals write-trough: prevents batching on disk drive/controller track caching achieves high transfer rates by actually reading entire track instead of just requested block defragmentation reorganizes files for contiguous access CSC400 - I/O Device Management 37 Disk Performance - 2 RAID (Redundant Arrays of Inexpensive Disks) useful in web/database servers to provide increased performance or redundancy provides different levels: Level 0 / Striping distributed data, no redundancy Level 1 / Mirroring pairs drives for redundancy Levels 2..6 supports error correction via redundancy and various Error-Correcting Coding (ECC) schemes ref: http://www.webopedia.com/term/r/raid.html CSC400 - I/O Device Management 38 CSC400 - Operating Systems 19