Objective. Input Output. Raul Queiroz Feitosa. This chapter presents concepts, structures and functions involved in I/O operation.

Similar documents
Computer Organization & Architecture Lecture #19

Chapter 1 Computer System Overview

Computer Systems Structure Input/Output

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

1. Computer System Structure and Components

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

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Chapter 11: Input/Output Organisation. Lesson 06: Programmed IO

Microprocessor & Assembly Language

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Central Processing Unit

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

INPUT/OUTPUT ORGANIZATION

MICROPROCESSOR AND MICROCOMPUTER BASICS

COMPUTER ARCHITECTURE. Input/Output

Input / Output and I/O Strategies

PART B QUESTIONS AND ANSWERS UNIT I

CHAPTER 7: The CPU and Memory

Central Processing Unit (CPU)

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

(Refer Slide Time: 00:01:16 min)

Computer-System Architecture

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Devices and Device Controllers

Read this before starting!

What is a bus? A Bus is: Advantages of Buses. Disadvantage of Buses. Master versus Slave. The General Organization of a Bus

Serial Communications

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

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

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

Chapter 13. PIC Family Microcontroller

Introduction. What is an Operating System?

Computer Organization. and Instruction Execution. August 22

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

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

CSC 2405: Computer Systems II

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Chapter 11 I/O Management and Disk Scheduling

Exception and Interrupt Handling in ARM

Communicating with devices

The Central Processing Unit:

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

361 Computer Architecture Lecture 14: Cache Memory

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Computer Organization and Architecture

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

S7 for Windows S7-300/400

Chapter 2: OS Overview

An Introduction To Simple Scheduling (Primarily targeted at Arduino Platform)

21152 PCI-to-PCI Bridge

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Solid State Drive Architecture

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

An Introduction to the ARM 7 Architecture

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

MACHINE ARCHITECTURE & LANGUAGE

Putting it all together: Intel Nehalem.

Chapter 6, The Operating System Machine Level

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

We r e going to play Final (exam) Jeopardy! "Answers:" "Questions:" - 1 -

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

TIMING DIAGRAM O 8085

CSE2102 Digital Design II - Topics CSE Digital Design II

OPERATING SYSTEM SERVICES

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

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

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

Operating System Tutorial

Programming Logic controllers

Chapter 13 Selected Storage Systems and Interface

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

Chapter 4 System Unit Components. Discovering Computers Your Interactive Guide to the Digital World

Chapter 2 Logic Gates and Introduction to Computer Architecture

CPUs - CPU PN/DP

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

BASIC COMPUTER ORGANIZATION AND DESIGN

Training Document for Comprehensive Automation Solutions Totally Integrated Automation (T I A) MODULE A5 Programming the CPU 314C-2DP

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Design Issues in a Bare PC Web Server

Microtronics technologies Mobile:

Chapter 5 Busses, Ports and Connecting Peripherals

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Technical Product Specifications Dell Dimension 2400 Created by: Scott Puckett

Quiz for Chapter 6 Storage and Other I/O Topics 3.10

THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals

Discovering Computers Living in a Digital World

Hello, and welcome to this presentation of the STM32 SDMMC controller module. It covers the main features of the controller which is used to connect

Instruction Set Architecture

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

8051 MICROCONTROLLER COURSE

CSCI 4717 Computer Architecture. Function. Data Storage. Data Processing. Data movement to a peripheral. Data Movement

Programming A PLC. Standard Instructions

UNIT 4 Software Development Flow

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

What is a System on a Chip?

Buffer Management 5. Buffer Management

TEST CHAPTERS 1 & 2 OPERATING SYSTEMS

Transcription:

Input Output Raul Queiroz Feitosa Parts of these slides are from the support material provided by W. Stallings Objective This chapter presents concepts, structures and functions involved in I/O operation. Input Output 2 1

Outline I/O Modules I/O Techniques Programmed I/O Interrupt driven I/O Direct Memory Access (DMA) I/O Channels and I/O Processors Input Output 3 Generic Model of I/O Module Wide variety of peripherals Delivering different amounts of data At different speeds In different formats Most of them slower than CPU and RAM Need I/O modules as interface to CPU and Memory via bus or central switch to one or more peripherals Input Output 4 2

External Device Block Diagram Input Output 5 I/O Module Function 1. Control & Timing 2. CPU Communication 3. Device Communication 4. Data Buffering 5. Error Detection Input Output 6 3

I/O Module Function Control & Timing : The data transfer will typically involve the following steps: a) CPU checks I/O module device status b) I/O module returns status c) If ready, CPU requests data transfer d) I/O module gets data from device e) I/O module transfers data to CPU d) I/O module transfers data from CPU e) I/O module sends data to device Input Output 7 I/O Module Function Processor Communication : involves the following steps: a) Command decoding: typically word commands are sent through the bus to the I/O module. b) Data: exchanged between cpu and I/O module through the bus. c) Status reporting: because peripherals are slow the cpu must know the status of the I/O module is it ready to receive one more data unit? d) Address recognition: I/O modules are accessed quite in the same way as memory locations Input Output 8 4

INTERFACE TO SYSTEM BUS INTERFACE TO EXTERNAL DEVICE I/O Module Function Device Communication Commands, status information and data Data lines Address lines Control lines Data registers Status/control registers I/O logic External device interface logic. External device interface logic Data Status Control. Data Status Control BLOCK DIAGRAM OF AN I/O MODULE Input Output 9 I/O Module Function Data Buffering to cope with the different transfer rates between memory and peripheral devices. Error Detection and reporting to the processor Input Output 10 5

Outline I/O Modules I/O Techniques Programmed I/O Interrupt driven I/O Direct Memory Access (DMA) I/O Channels and I/O Processors Input Output 11 Input Output Techniques I/O Technique Task Read Status Data Transfer 1. Programmed I/O CPU CPU 2. Interrupt driven I/O I/O module CPU 3. Direct Memory Access (DMA) DMA module DMA module Input Output 12 6

busy waiting Programmed I/O Input Output 13 Programmed I/O CPU has direct control over I/O Sensing status Read/write commands Transferring data CPU waits for I/O module to complete operation Wastes CPU time Simplest implementation Input Output 14 7

I/O Commands CPU issues address Identifies module (& device if >1 per module) Very like memory accesses with separated or common address spaces CPU issues command Control - telling module what to do e.g. spin up disk Test - check status e.g. power? Error? CPU reads/writes information Module transfers data via buffer from/to device Input Output 15 I/O Mapping Memory mapped I/O Devices and memory share a common address space I/O looks just like memory read/write No special commands for I/O Isolated I/O Large selection of memory access commands available Separate address spaces Need I/O or memory select lines Special commands for I/O Limited set Input Output 16 8

Memory Mapped I/O 516 same instruction to access memory 517 ADDRESS INSTRUCTION OPERAND COMMENT 200 Load AC 1 Load accumulator Store AC 517 Initiate keyboard read 202 Load AC 517 Get status byte Branch if Sign=0 202 Loop until ready Load AC 516 Load data byte Input Output 17 Isolated I/O 5 specific instructions to access I/O... 6 ADDRESS INSTRUCTION OPERAND COMMENT 200 Load AC 1 Load accumulator Out 6 Initiate keyboard read 202 In 6 Get status byte Branch if Sign=0 202 Loop until ready In 5 Load data byte Input Output 18 9

INTERFACE TO SYSTEM BUS INTERFACE TO EXTERNAL DEVICE I/O Mapping Data lines Address lines Control lines memory read i/o read memory write i/o write Data registers Status/control registers I/O logic RD WR BLOCK DIAGRAM OF AN I/O MODULE External device interface logic up memory mapped I/O down isolated I/O Data Status Control Data Status Control Input Output 19. External device interface logic. Interrupt Driven I/O Overcomes CPU waiting No repeated CPU checking of device I/O module interrupts when ready Input Output 20 10

Interrupt Driven I/O Input Output 21 Simple Interrupt Processing Input Output 22 11

On Interrupt Acknowledge 1. Processor acknowledges interrupt request, while executing instruction at location N. 2. Processor saves current PC and register contents program. 3. Processor loads the entry location of the interrupthandling program. N+1 Y program counter general registers T-M T+1 T stack pointer Processor control stack interrupt service routine user s program N+1 T start return Y+L Input Output 23 T-M Y N Main Memory N+1 On Interrupt Return 1. Processor retrieves saved register contents from the stack. 2. Processor retrieves saved PC and PSW from the stack. Y+L N+1 program counter general registers T-M T+1 T stack pointer Processor control stack interrupt service routine user s program N+1 start return Y+L Input Output 24 T-M T Y N Main Memory N+1 12

Design Issues 1. How do you identify the module issuing the interrupt? 2. How do you deal with multiple interrupts? i.e. an interrupt handler being interrupted Input Output 25 Identifying Interrupting Module (1) Different line for each module PC Limits number of devices Software poll CPU asks each module in turn Slow Input Output 26 13

Identifying Interrupting Module (2) Daisy Chain or Hardware poll Interrupt Acknowledge ( read access) sent down a chain, or parallel to all devices. Module responsible places vector on bus CPU uses vector to identify handler routine Bus Master Module must claim the bus before it can raise interrupt e.g. PCI & SCSI Input Output 27 Direct Memory Access Drawbacks with previous I/O strategies : both require active CPU intervention Transfer rate is limited CPU is tied up DMA is the answer! Additional Module (hardware) on bus DMA controller takes over from CPU for I/O Input Output 28 14

Direct Memory Access Input Output 29 DMA controller diagram Data lines Data registers Status/control registers External device interface logic DMA request DMA acknowledge Address lines Control lines interrupt request request DMA memory read i/o read memory write i/o write Address registers Control logic.. External device interface logic DMA request DMA acknowledge Input Output 30 RD WR 15

till a whole bock is transferred till a whole bock is transferred DMA Operation CPU tells DMA controller: DMA controller command registers Read/Write Device address Starting address of memory block for data Amount of data to be transferred CPU carries on with other work DMA controller deals with transfer DMA controller sends interrupt when finished Input Output 31 DMA transfer modes block mode cycle stealing DMA controller takes over bus DMA controller takes over bus DMA controller transfer one word DMA controller transfer one word DMA controller return bus control DMA controller return bus control Input Output 32 16

DMA transfer modes In block mode as well as in cycle stealing CPU is suspended, not interrupted CPU does not switch context CPU suspended just before it accesses bus i.e. before an operand or data fetch or a data write Slows down CPU but not as much as CPU doing transfer. Input Output 33 DMA and Interrupt Breakpoints During an Instruction Cycle Input Output 34 17

DMA Configurations (1) (a) Single-bus, detached DMA Single Bus, Detached DMA controller Input Output 35 DMA Configurations (2) (b) Single-bus, Integrated DMA-I/O Single Bus, Integrated DMA I/Ocontroller Controller may support >1 device Input Output 36 18

DMA Configurations (3) System Bus I/O Bus Separate I/O Bus (c) I/O Bus Bus supports all DMA enabled devices Input Output 37 Outline I/O Modules I/O Techniques Programmed I/O Interrupt driven I/O Direct Memory Access (DMA) I/O Channels and I/O Processors Input Output 38 19

I/O Channels and I/O Processors Enhanced I/O modules with a built-in programmable processor if it shares the system memory I/O channel if it has its own memory I/O processor CPU instructs I/O channel/processor to do transfer I/O channel/processor does entire transfer and interrupts CPU at the end. Improves overall speed. e.g. 3D graphics cards. Input Output 39 I/O Channels and I/O Processors Types Selector channel Controls multiple high-speed devices And is dedicated to one of them at a time Each (or a small set of) device is handled by a controller or I/O module The IO/Channel serves in place of the CPU to control these I/O controllers Multiplexor channel Handle multiple devices at the same time. Input Output 40 20

Interfacing I/O module to system bus buffer to peripheral Stores data being passed. Compensates the differences in speed. Parallel I/O I/O module becoming less common due to new generation of serial interfaces to system bus buffer to peripheral Serial I/O Input Output 41 Firewire versus USB Firewire: Firewire 400: 400 Mbps = 50 MB/s Firewire 800: 800 Mbps = 100 MB/s USB: USB 1.0: 1.5 Mbps = 0.188 MB/s USB 1.1: 12 Mbps = 1.5 MB/s USB 2.0: 480 Mbps = 60 MB/s USB 3.0: 5000 Gbps = 640 MB/s (rarely in practice) Input Output 42 21

Interface Speeds 800 400 Input Output 43 Exercise 7.6 For a programmed I/O the processor is stuck in a wait loop doing status checking of an I/O device. To increase efficiency, the I/O software could be written so that the processor periodically checks the stats of the device. If the device is not ready, the process can jump to other tasks. After some timed interval, the processor comes back to check status again a) Consider the above scheme for outputting data one character at a time to a printer that operates at 10 characters per second (cps). What will happen if the status is scanned every 200ms? b) Next consider a keyboard with a single character buffer. On average, characters are entered at a rate of 10 cps. However, the time interval between two consecutive key depressions can be as short as 80 ms. At what frequency should the keyboard be scanned by the I/O programm? Interconnection Structures 44 22

Exercise 7.8 In this presentation one advantage and one disadvantage of memory-mapped I/O compared with isolated I/O were listed. List two more advantages and two more disadvantages. Interconnection Structures 45 Exercise 7.10 Consider a system employing interrupt-driven I/O for a particular device that transfers data at an average of 8 KB/s on a continuous basis. a) Assume that interrupt processing takes about 100 μs (i.e., the time to jump to the interrupt service routine (ISR), execute it, and return to the main program). Determine what fraction of processor time is consumed by this I/O device if it interrupts for every byte. b) Now assume that the device has two 16-byte buffers and interrupts the processor when one of the buffers is full. Naturally, interrupt processing takes longer, because the ISR must transfer 16 bytes. While executing the ISR, the processor takes about 8 μs for the transfer of each byte. Determine what fraction of processor time is consumed by this I/O device in this case. Interconnection Structures 46 23

Exercise 7.12 A DMA module is transferring characters to memory using cycle stealing, from a device transmitting at 9600 bps. The processor is fetching instructions at the rate of 1 million instruction per second (1 MIPS). By how much will the processor be slowed down due to the DMA activity? Interconnection Structures 47 Exercise 7.13 Consider a system in which bus cycles take 500 ns. Transfer of bus control in either direction, from processor to I/O device or vice-versa, takes 250 ns. One of the I/O devices has a data transfer rate of 50 KB/s and employs DMA. Data are transferred one byte at a time. a) Suppose we employ DMA at a burst mode. That is, the DMA interface gains bus mastership prior to the start of a block transfer and maintains control of the bus until the whole block is transferred. For how long would the device tie up the bus when transferring a block of 128 bytes? b)repeat the calculation for cycle-stealing mode. Interconnection Structures 48 24

Question of a prior G2 At t 0 a disk controller receives from processor a command to transfer a 512 byte long sector to the main memory. These bytes become available in the controller s buffer 5,000 μs after t 0. The byte transfer from buffer to main memory may be executed at any time from then on. The controller may adopt three management strategies: a) Programmed I/O: Starting at t 0. + 500 μs a program is executed by the processor every 500 μs to check if the buffer is full. If the buffer is still not full, the execution time of this program is equal to 50μs. If the buffer is full, 5μs is added to this execution time for each transferred byte. The symbol t 1. denotes the time when the transfer of all bytes is completed Compute the time between t 0 and t 1, available for the processor to execute tasks other than I/O management. b) Interruption: As soon as the buffer is full, an interrupt service routine is executed. Its execution time is the same as the program of question a) when the buffer is full. In this case the transfer is completed at t 2. Compute the time between t 0 and t 2, available for the processor to execute tasks other than I/O management. c) DMA: When the buffer is full the DMA controller transfers the data in block mode, one byte per μs. Assume that the time to switch bus ownership between processor and DMA controller and vice-versa are negligible. In this case the transfer is finished at t 3. Compute the time between t 0 and t 3, available for the processor to execute tasks other than I/O management. Text Book References These topics are covered in Stallings - chapter 7 Tanenbaum - Parhami - chapter 22 Input Output 50 25

Input Output END Input Output 51 26