Computer Input & Output Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.

Slides:



Advertisements
Similar presentations
Chapter 6 I/O Systems.
Advertisements

I/O Chapter 8. Outline Introduction Disk Storage and Dependability – 8.2 Buses and other connectors – 8.4 I/O performance measures – 8.6.
Lecture Objectives: 1)Explain the limitations of flash memory. 2)Define wear leveling. 3)Define the term IO Transaction 4)Define the terms synchronous.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Computer-System Structures
1/21/2010CSCI 315 Operating Systems Design1 Computer System Structures Notice: The slides for this lecture have been largely based on those accompanying.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Chapter 6 Storage and Other I/O Topics CprE 381 Computer Organization and Assembly Level Programming, Fall 2013 Zhao Zhang Iowa State University Revised.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Memory/Storage Architecture Lab Computer Architecture Lecture Storage and Other I/O Topics.
C OMPUTER O RGANIZATION AND D ESIGN The Hardware/Software Interface 5 th Edition Chapter 5 Storage and Other I/O Topics (condensed lecture)
I/O – Chapter 8 Introduction Disk Storage and Dependability – 8.2 Buses and other connectors – 8.4 I/O performance measures – 8.6.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
I/O 1 Computer Organization II © McQuain Introduction I/O devices can be characterized by – Behavior: input, output, storage – Partner:
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell CS352H: Computer Systems Architecture Topic 13: I/O Systems.
I/O Systems I/O Hardware Application I/O Interface
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Lecture 16: Storage and I/O EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Spring 2014, Dr.
I/O Computer Organization II 1 Introduction I/O devices can be characterized by – Behavior: input, output, storage – Partner: human or machine – Data rate:
Lecture 35: Chapter 6 Today’s topic –I/O Overview 1.
I/O Computer Organization II 1 Interconnecting Components Need interconnections between – CPU, memory, I/O controllers Bus: shared communication channel.
Computer Organization CS224 Fall 2012 Lessons 47 & 48.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Introduction I/O devices can be characterized by – Behaviour: input, output, storage – Partner: human or machine – Data rate: bytes/sec, transfers/sec.
Chapter 6 Storage and Other I/O Topics. Chapter 6 — Storage and Other I/O Topics — 2 Introduction I/O bus connections §6.1 Introduction.
Chapter 6 Storage and Other I/O Topics. Chapter 6 — Storage and Other I/O Topics — 2 Introduction I/O devices can be characterized by Behaviour: input,
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Chapter 6 Storage and Other I/O Topics. Chapter 6 — Storage and Other I/O Topics — 2 Introduction I/O devices can be characterized by Behaviour: input,
Review of Computer System Organization. Computer Startup For a computer to start running when it is first powered up, it needs to execute an initial program.
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
1 Lecture 23: Storage Systems Topics: disk access, bus design, evaluation metrics, RAID (Sections )
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Chapter 6 Storage and Other I/O Topics. Chapter 6 — Storage and Other I/O Topics — 2 Introduction I/O devices can be characterized by Behaviour: input,
Chapter 6 — Storage and Other I/O Topics — 1 Introduction I/O devices can be characterized by Behaviour: input, output, storage Partner: human or machine.
Chapter 6 Storage and Other I/O Topics. Chapter 6 — Storage and Other I/O Topics — 2 Introduction I/O devices can be characterized by Behaviour: input,
Modified by S. J. Fritz Spring 2009 (1) Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly.
LECTURE 13 I/O. I/O CANNOT BE IGNORED Assume a program requires 100 seconds, 90 seconds for main memory, 10 seconds for I/O. Assume main memory access.
Computer Organization & Design 计算机组成与设计 Weidong Wang ( 王维东 ) College of Information Science & Electronic Engineering 信息与通信工程研究所 Zhejiang.
CSCE 385: Computer Architecture Spring 2014 Dr. Mike Turi I/O.
I/O Lecture notes from MKP and S. Yalamanchili.
Module 12: I/O Systems I/O hardware Application I/O Interface
Morgan Kaufmann Publishers Storage and Other I/O Topics
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Chapter 2: Computer-System Structures
Morgan Kaufmann Publishers Storage and Other I/O Topics
The Memory Hierarchy Chapter 5
Introduction I/O devices can be characterized by I/O bus connections
Lecture 13 I/O.
Module 2: Computer-System Structures
Morgan Kaufmann Publishers Storage and Other I/O Topics
Morgan Kaufmann Publishers Storage and Other I/O Topics
Morgan Kaufmann Publishers Storage and Other I/O Topics
Module 2: Computer-System Structures
CSC3050 – Computer Architecture
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 13: I/O Systems.
Presentation transcript:

Computer Input & Output Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Chapter 6 — Storage and Other I/O Topics — 2 Introduction I/O devices can be characterized by Behaviour: input, output, storage Partner: human or machine Data rate: bytes/sec, transfers/sec I/O bus connections §6.1 Introduction

Four Strategies for Managing I/O Program Controlled I/O The CPU manages every aspect of I/O processing. I/O occurs only when the program calls for it. If the I/O device is not ready to perform its function, the CPU waits for it to be ready; this is “busy waiting”. Interrupt Driven I/O The I/O device raises a signal called an “interrupt” when it is ready to perform the I/O. The I/O is managed by the CPU, but proceeds only when the device is ready for it. Direct Memory Access This variant elaborates on the two above. The I/O device interrupts and is sent a “word count” and starting address by the CPU. The individual transfers are managed by the device controller, not the CPU. I/O Channel This assigns I/O to a separate processor, which uses one of the above three strategies.

I/O Strategies: A Silly Example I am giving a party to which a number of people are invited. I know exactly how many people will attend. I know that the guests will not arrive before 6:00 PM. All guests will enter through my front door. In addition to the regular door (which can be locked), it has a screen door and a doorbell. I have ordered pizzas and beer, each to be delivered. All deliveries at the back door. I must divide my time between baking cookies for the party and going to the door to let the visitors in. I am a careless cook and often burn the cookies.

The Silly Example: Program Controlled I/O The guests are due, starting at 6:00 PM. Here I go to the door at 6:00 PM and wait. As each one arrives, I open the door and admit the guest. I do not leave the door until the last guest has arrived; nothing gets done in the kitchen.

The Silly Example: Interrupt-Driven I/O I continue working in the kitchen until the doorbell rings. When the doorbell rings, I put down my work, go to the door, and admit the guest. However, note the following: 1.I do not “drop” the work, but bring it to a quick and orderly conclusion. If I am removing cookies from the oven, I place them in a safe place to cool before answering the door. 2.If I am fighting a grease fire, I ignore the doorbell and first put out the fire. Only when it is safe do I attend to the door. 3.With a guest at the front door and the beer truck at the back door, I have a difficult choice, but I must attend to each.

The Silly Example: Direct Memory Access I continue work in the kitchen until the first guest arrives and rings the doorbell. I go to the door, unlock it, admit the guest. I leave the main door open. Each guest now enters without ringing the doorbell. The last guest is asked to notify me, so that I can return to the front door and close it again. In the Interrupt Driven analog, I had to go to the door once for each guest. In the DMA analog, I had to go to the door only twice.

The Silly Example: I/O Channel Here, I hire a butler and tell him to manage the door any way he wants. He just has to get the guests into the party and keep them happy.

Device Management The primary issue in choosing a strategy for I/O is the relative speed of I/O and the CPU. Program controlled I/O may be appropriate when the I/O device is purely electronic and able to transfer data almost instantly. The context for the other strategies is that the CPU can execute other processes while waiting on the given I/O to complete.

The Classic Process Diagram

Chapter 6 — Storage and Other I/O Topics — 11 Polling Periodically check I/O status register If device ready, do operation If error, take action Common in small or low-performance real- time embedded systems Predictable timing Low hardware cost In other systems, wastes CPU time

Chapter 6 — Storage and Other I/O Topics — 12 Interrupts When a device is ready or error occurs Controller interrupts CPU Interrupt is like an exception But not synchronized to instruction execution Can invoke handler between instructions Cause information often identifies the interrupting device Priority interrupts Devices needing more urgent attention get higher priority Can interrupt handler for a lower priority interrupt

The PDP-11 Priority Structure The I/O system of the old PDP-11 was based on eight priority levels: 0 through 7. User programs execute at priority level 0. The device handler programs execute at the device priority level. The disk is assigned priority level 7. The keyboard is assigned priority level 4. An interrupt is processed only if its priority is higher than that of the executing program.

Chapter 6 — Storage and Other I/O Topics — 14 I/O Data Transfer Polling and interrupt-driven I/O CPU transfers data between memory and I/O data registers Time consuming for high-speed devices Direct memory access (DMA) OS provides starting address in memory I/O controller transfers to/from memory autonomously Controller interrupts on completion or error

Chapter 6 — Storage and Other I/O Topics — 15 DMA/Cache Interaction If DMA writes to a memory block that is cached Cached copy becomes stale If write-back cache has dirty block, and DMA reads memory block Reads stale data Need to ensure cache coherence Flush blocks from cache if they will be used for DMA Or use non-cacheable memory locations for I/O

Chapter 6 — Storage and Other I/O Topics — 16 DMA/VM Interaction OS uses virtual addresses for memory DMA blocks may not be contiguous in physical memory Should DMA use virtual addresses? Would require controller to do translation If DMA uses physical addresses May need to break transfers into page-sized chunks Or chain multiple transfers Or allocate contiguous physical pages for DMA

DMA and Memory Protection The Operating System uses Virtual Memory as a tool to protect physical memory from access that is possibly harmful. If DMA bypasses the VM system, it bypasses this level of protection. Device driver software is usually written by the device vendor; it is suspect. The hardware can have a “No DMA Table”.

I/O Channels and Processors Manufacturers have elected to use attached I/O processors for a number of reasons. Balance of function: IBM 1401 and IBM Removal of I/O functionality from a CPU dedicated to numerical computations, as in the CDC 6600, CDC 7600, or Cray-1. Enterprise servers, such as the IBM S/360 are transaction processors with heavy I/O.

Chapter 6 — Storage and Other I/O Topics — 19 I/O System Characteristics Dependability is important Particularly for storage devices Performance measures Latency (response time) Throughput (bandwidth) Desktops & embedded systems Mainly interested in response time & diversity of devices Servers Mainly interested in throughput & expandability of devices

Chapter 6 — Storage and Other I/O Topics — 20 Dependability Fault: failure of a component May or may not lead to system failure §6.2 Dependability, Reliability, and Availability Service accomplishment Service delivered as specified Service interruption Deviation from specified service FailureRestoration

Chapter 6 — Storage and Other I/O Topics — 21 Dependability Measures Reliability: mean time to failure (MTTF) Service interruption: mean time to repair (MTTR) Mean time between failures MTBF = MTTF + MTTR Availability = MTTF / (MTTF + MTTR) Improving Availability Increase MTTF: fault avoidance, fault tolerance, fault forecasting Reduce MTTR: improved tools and processes for diagnosis and repair

The DASD The term “DASD” is an IBM term that stands for “Direct Access Storage Device”. One hears the term “DASD” only in IBM enterprise server shops. There used to be two DASDs: magnetic disks and magnetic drums. Magnetic drums are obsolete. A flash drive may be called a DASD.

The IBM 2311

Disk Platters

The Sealed Disk Drive

Chapter 6 — Storage and Other I/O Topics — 26 Disk Storage Nonvolatile, rotating magnetic storage §6.3 Disk Storage

The Read/Write Heads

Chapter 6 — Storage and Other I/O Topics — 28 Disk Sectors and Access Each sector records Sector ID Data (512 bytes, 4096 bytes proposed) Error correcting code (ECC) Used to hide defects and recording errors Synchronization fields and gaps Access to a sector involves Queuing delay if other accesses are pending Seek: move the heads Rotational latency Data transfer Controller overhead

The Disk Platter

Modern Disk Organization

Seek Time and Rotational Latency The seek time is defined as the time to move the read/write heads to another track. There are two values: track-to-track (time to move to an adjacent track) and average. The rotational latency is the average time to rotate the sector under the read/write heads. At 12,000 rpm (200/second), the disk revolves every 5 milliseconds; latency = 2.5 msec.

The Data Transfer Rate The maximum data transfer rate for a disk is set by its rotational speed. The contents of one track being read for one rotation sets the maximum data transfer rate. At 12,000 RPM, there is one revolution every 1/200 of a second. If the track has 1.2 MB of data, the maximum transfer rate is 1.2 MB / (1/200) = 240 MB/s.

Chapter 6 — Storage and Other I/O Topics — 33 Disk Access Example Given 512B sector, 15,000rpm, 4ms average seek time, 100MB/s transfer rate, 0.2ms controller overhead, idle disk Average read time 4ms seek time + ½ / (15,000/60) = 2ms rotational latency / 100MB/s = 0.005ms transfer time + 0.2ms controller delay = 6.2ms If actual average seek time is 1ms Average read time = 3.2ms

Chapter 6 — Storage and Other I/O Topics — 34 Disk Performance Issues Manufacturers quote average seek time Based on all possible seeks Locality and OS scheduling lead to smaller actual average seek times Smart disk controller allocate physical sectors on disk Present logical sector interface to host SCSI, ATA, SATA Disk drives include caches Prefetch sectors in anticipation of access Avoid seek and rotational delay

Chapter 6 — Storage and Other I/O Topics — 35 Flash Storage Nonvolatile semiconductor storage 100× – 1000× faster than disk Smaller, lower power, more robust But more $/GB (between disk and DRAM) §6.4 Flash Storage

Chapter 6 — Storage and Other I/O Topics — 36 Flash Types NOR flash: bit cell like a NOR gate Random read/write access Used for instruction memory in embedded systems NAND flash: bit cell like a NAND gate Denser (bits/area), but block-at-a-time access Cheaper per GB Used for USB keys, media storage, … Flash bits wears out after 1000’s of accesses Not suitable for direct RAM or disk replacement Wear leveling: remap data to less used blocks