© Janice Regan, CMPT 300, May 2007 0 CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.

Slides:



Advertisements
Similar presentations
I/O Management and Disk Scheduling
Advertisements

Categories of I/O Devices
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
INPUT-OUTPUT ORGANIZATION
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
Chapter 7 Interupts DMA Channels Context Switching.
Device Management.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
Copyright ©: Nahrstedt, Angrave, Abdelzaher
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
INPUT-OUTPUT ORGANIZATION
INPUT/OUTPUT ARCHITECTURE By Truc Truong. Input Devices Keyboard Keyboard Mouse Mouse Scanner Scanner CD-Rom CD-Rom Game Controller Game Controller.
Input / Output CS 537 – Introduction to Operating Systems.
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
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.
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
NETW 3005 I/O Systems. Reading For this lecture, you should have read Chapter 13 (Sections 1-4, 7). NETW3005 (Operating Systems) Lecture 10 - I/O Systems2.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
2007 Oct 18SYSC2001* - Dept. Systems and Computer Engineering, Carleton University Fall SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices.
I/O Example: Disk Drives To access data: — seek: position head over the proper track (8 to 20 ms. avg.) — rotational latency: wait for desired sector (.5.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
Interrupts By Ryan Morris. Overview ● I/O Paradigm ● Synchronization ● Polling ● Control and Status Registers ● Interrupt Driven I/O ● Importance of Interrupts.
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
Input/Output Computer component : Input/Output I/O Modules External Devices I/O Modules Function and Structure I/O Operation Techniques I/O Channels and.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
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.
Fall 2000M.B. Ibáñez Lecture 25 I/O Systems. Fall 2000M.B. Ibáñez Categories of I/O Devices Human readable –used to communicate with the user –video display.
12/8/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
Lecture 1: Review of Computer Organization
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.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 I/O through system calls Protection.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
بسم الله الرحمن الرحيم MEMORY AND I/O.
I/O Software CS 537 – Introduction to Operating Systems.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
1 load [2], [9] Transfer contents of memory location 9 to memory location 2. Illegal instruction.
Computer Organization and Architecture + Networks Lecture 6 Input/Output.
Input/Output (I/O) Important OS function – control I/O
I/O SYSTEMS MANAGEMENT Krishna Kumar Ahirwar ( )
Operating Systems (CS 340 D)
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
Computer Architecture
BIC 10503: COMPUTER ARCHITECTURE
Computer-System Architecture
Module 2: Computer-System Structures
Operating Systems Chapter 5: Input/Output Management
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 13: I/O Systems.
Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Presentation transcript:

© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware

© Janice Regan, CMPT 300, May Controlling I/O  One of the most complex jobs done by the OS is to manage input and output  The job is complex because  There are many different types of I/O devices  Different I/O devices operate at different data rates  There are different approaches to controlling I/O that must be considered when designing the system (hardware and software)

© Janice Regan, CMPT 300, May Types of I/O devices  Human readable devices  Printers  Terminals/workstation monitors  Plotters  Machine readable  Keyboard, Mouse, touch screen  Disk drives  Tape drives  Sensors,  Communication with remote devices  Network card  modem

© Janice Regan, CMPT 300, May Important considerations  Data rate  Data representation:  Encoding  Error checking:  How to detect and deal with errors  Transfer unit  Byte stream (character device)  Block by block (block device)  Complexity of hardware and software needs

© Janice Regan, CMPT 300, May Approaches to I/O  The simplest approach: Programmed I/O  CPU issues an I/O command  CPU busy waits (or polls) while I/O is completed  Interrupt Driven (byte stream)  CPU issues an I/O command to I/O device  CPU enters wait state  CPU continues with other processing (same or more likely different process)  I/O device generates an interrupt when it finishes and the CPU finishes processing the interrupt before continuing with its present calculations.  DMA (also interrupt driven) block transfer

© Janice Regan, CMPT 300, May Evolution of I/O  Direct processor control  I/O control module added: programmed I/O (no interrupts)  I/O control module make CPU independent execution of single byte I/O possible, use interrupts for efficiency  I/O control module given direct control for block transfer (early DMA). CPU only involved at start and end of transfer.  Enhanced I/O module (separate processor). Single user instruction to set up DMA for transfer. Can specify a series of I/O instructions as process, dowload process to I/O module and interrupt CPU only after all of them (the process) are complete.

© Janice Regan, CMPT 300, May Device controllers/drivers  Hardware units that are able to independently control the I/O device (without CPU intervention)  Controllers handle one or more devices of a particular type  Generally different I/O devices have different needs and will have their own particular controller  The controller generally processes a serial bit stream, usually buffering (particularly for block transfer devices and to help match different transfer rates)  The controller usually performing error detection / correction to assure error free transfer of each block (preamble with block identification, a checksum using error correction code)  The device driver is the software that it written to make the controller function. Without device drivers each application would have to explicity control all aspects of I/O from controlling the head on the disk drive to displaying line by line or pixel by pixel on the screen.

© Janice Regan, CMPT 300, May I/O control registers  Each device controller has registers that control operation  DMA has registers for read/write, I/O device address, block size, starting destination address, state  The controller must communicate with the CPU (the user process) to place values or check values in these registers  There may also be a data buffer as part of the controller. This data buffer is usually in the memory space of the OS, not the user process

© Janice Regan, CMPT 300, May CPU-register communication  Simplest approach:  Assembler language commands  Each controller register is assigned a port number  Command specifies controller register by port number, CPU register by name or address (two different address spaces)  Transfer of one value to one controller register is one assembler language instruction  More sophisticate approach  Memory mapped I/O  Hybrid systems use memory mapping for I/0 data buffers and ports for data registers (Pentium)

Memory region For I/O controller Buffers + registers OS Process N Process M Systems with 2 address spaces © Janice Regan, CMPT 300, May OS Memory region for I/O buffers Process N Process M Memory region for I/O registers HYBRI D SYSTE M

© Janice Regan, CMPT 300, May Memory mapped I/O  Map all control registers into the memory space  Memory map will have a block of addresses that physically corresponds the registers on the I/O controllers rather than to locations in main memory OS Memory region for I/O controller registers Process N Process M Memory map

© Janice Regan, CMPT 300, May Advantages: memory mapped I/O  Allows device drivers and low level control software to be written in C rather than assembler  Normal assembler instructions to access memory can be used to directly access controller registers  Every instruction that can access memory can also access controller registers, reducing the number of instructions needed for I/O  Can structure the system so that only needed drivers are loaded into user program (page per driver)  OS can have better control over controller registers

© Janice Regan, CMPT 300, May Disadvantages: memory mapped I/O  Need additional complexity in the OS  Cannot cache controller registers  Changes made in cache do not affect the controller!  Must assure that the memory range reserved for memory mapped controller registers cannot be cached. (disable caching)  All memory and I/O modules must examine all memory references  Optimized architectures with other bus structures may require special support for memory mapping

© Janice Regan, CMPT 300, May Single Bus: memory mapping  CPU sends requested address along bus  Bus carries one request/reply at a time  Each I/O device controller checks if requested address is in thier memory space  Device controller whose address space does contain the address replies with the requested value from that address CPUmemoryI/O

© Janice Regan, CMPT 300, May Memory Bus: memory mapping  Common to have high speed bus for memory access (e.g. pentium)  Memory accesses meant for mapped I/O registers will go to main memory along the high speed memory bus!  Use a dedicated filter (chip) to determine which bus to send to  Send to memory first, then bus if not found CPUmemoryI/O

© Janice Regan, CMPT 300, May Using DMA  DMA is used to transfer data between disk and memory (or disk and disk, memory to memory)  Disk access is much slower than memory access. Must assure that data is available when memory is ready (use buffering)  Transfer data in blocks  each block read from disk will be placed in a buffer from which the DMA can transfer it to memory  each block written to disk will be placed in a buffer by the DMA for later transfer to disk  The buffer is part of the disk controller  Also allows each block’s data to be checked for transfer errors

© Janice Regan, CMPT 300, May 2007 Disk read: without DMA  CPU requests data  Disk controller reads a block of data into its buffer. Data is read serially, bit by bit into the buffer.  The integrity of the transferred data block is verified  Controller sends interrupt to CPU indicating transfer to buffer is done  CPU can transfer from buffer to memory one byte or word at a time 16 CPU buffer Memory Disk controller b 5a 5c

Why a buffer?  Allows the controller to verify block of data is correct (has not been corrupted) by doing a checksum  Reduces problems due to bus contention  Avoids problem of another word arriving from disk before the current word has been transferred across the bus to the memory.  This problem can be common when the bus is busy, or when a burst transfer is occuring © Janice Regan, CMPT 300, May

© Janice Regan, CMPT 300, May DMA operation: using disk  CPU sends information to instruct DMA  DMA requests disk controller put block of data into its buffer and verify the integrity of the transferred data  Until all data is written to memory the following steps are repeated a. DMA sends data transfer request to disk controller. b. The disk controller writes a word from buffer to memory  The disk controller acks to the DMA  DMA sends interrupt to CPU indicating transfer is done CPU DMA addresses port Read/write count buffer Memory Disk controller 1 2 3b 3c 4 3a

More sophisticated DMAs  Can service more than one request at a time  Include multiple sets of registers to control multiple simultaneous transfers  Each transfer must be talking to a different device controller  Data transfer requests are made in some sequence (round robin of active transfers etc)  Sometimes differentiate acks by using different physical line in the bus. This will provide an unambiguous way to tell acks from different controllers apart  Can operate in different modes (parallel available bus modes) © Janice Regan, CMPT 300, May

© Janice Regan, CMPT 300, May DMA: transfer modes  Cycle Stealing  DMA requests Disk controller to send one word at a time  Each time a word is transferred bus must be requested and acquired then data sent and ack received  Requests interleave with CPU bus requests, CPU may have to wait for bus in some cases  Words may go directly or through DMA (more flexible allows memory to memory and disk to disk transfers)  Block Mode  One request made for bus (increases efficiency)  Entire block transferred  Ack sent  Bus becomes available for other users  CPU may have to wait for block transfer to complete before it can reacquires bus

© Janice Regan, CMPT 300, May IO bus CPUmemoryDMAI/O CPUmemory I/O DMA