Input and Output Computer Organization and Assembly Language: Module 9.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

Input and Output CS 215 Lecture #20.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Chapter 7 Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats.
Input and Output How things get into and out of the CPU.
Copyright ©: Nahrstedt, Angrave, Abdelzaher
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.
MIPS I/O and Interrupt. SPIM I/O and MIPS Interrupts The materials of this lecture can be found in A7-A8 (3 rd Edition) and B7-B8 (4 th Edition).
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
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.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Input/ Output By Mohit Sehgal. What is Input/Output of a Computer? Connection with Machine Every machine has I/O (Like a function) In computing, input/output,
MICROPROCESSOR INPUT/OUTPUT
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Chapter 2: Computer-System Structures
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
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.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
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.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
MIPS I/O and Interrupt.
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
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
I/O Organization Competency – C6. Important facts to remember when I/O devices are to be connected to CPU There is a vast variety of I/O devices. Some.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
بسم الله الرحمن الرحيم MEMORY AND I/O.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Computer System Structures
Operating Systems (CS 340 D)
Input/Output.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer Architecture
Module 2: Computer-System Structures
Computer Architecture and Assembly Language
Module 2: Computer-System Structures
Chapter 8 I/O.
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

Input and Output Computer Organization and Assembly Language: Module 9

Motivation u Input and output devices (I/O devices) allow computers to perceive and effect their environment u Input devices are often much slower than the computer: the computer can process data faster than the device can provide data u Some output devices have are also slow relative to the speed of memory access or CPU computation; they cannot accept data at the rate provided

General Categories of I/O u User interface devices  Input devices: mouse, keyboard  Output devices: terminal display, printer u Mass storage devices  Disks, tape drives u Gateways and networks

Hardware: I/O instructions u The hardware implements special instructions to read from/write to I/O devices.  Perhaps lwio (load word I/O) and swio u The devices have a separate address space from memory  lwio $s0, 16 and lw $s0, 16 access different data  lwio $s0, 16 reads the next word from device 16  lw $s0, 16 reads the word stored in memory location 16. u MIPS does NOT use special I/O instructions

Hardware: Memory-Mapped I/O u The hardware can be designed in such a way that some memory addresses are not really memory at all but a collection of communication channels to I/O devices. u In memory-mapped I/O, load and store from/to the communication channels provide a means of performing I/O, i.e., load and store instructions with an I/O address are treated as I/O operations. lw $a0, KeyboardData sw $t0, DisplayData communication channels

Hardware: Memory-Mapped I/O u MIPS RISC architecture uses memory-mapped I/O. u I/O devices, unlike memory, may be unavailable. If a device is not ready to accept or transmit data then it is busy.  The system must provide a mechanism for allowing a program to detect if a device is ready or busy u The processor communicates with an I/O device using two addresses: one for data exchange and the other to obtain the status of the I/O device.

Memory mapped addresses in SPIM keyboard_control = 0xffff0000display_control = 0xffff0008 keyboard_data = 0xffff0004display_data = 0xffff000c 1 0 Interrupt enable (1 = enabled) Device busy/ready (1 = ready) Control Data

Memory mapped addresses in SPIM u Define the memory mapped constants like this:.data 0xffff0000 keyboard_control:.space 4 keyboard_data:.space 4 display_control:.space 4 display_data:.space 4

Software: Managing I/O u Programmed I/O (Polling) u Interrupt driven I/O

Software: Programmed I/O wait: lw $s0,keyboard_control and $s0, $s0, 1 beq $s0, 0, wait lw $v0,keyboard_data wait: lw $s0,display_control and $s0, $s0, 1 beq $s0, 0, wait sw $v0,display_data 1 = ready 0 = busy least significant bit In programmed I/O, the CPU stays in a loop until the I/O unit indicates that is ready for data transfer or if the CPU has issued a command to the I/O module it must wait until the operation is complete.

Software: Interrupt Driven I/O u Instead of spin-waiting or doing a regular check whether an I/O device is ready, the I/O device can just inform the CPU that it is ready to receive or transmit data. The I/O device sends an interrupt signal to the system. u In this mechanism, control is transferred to the exception handler (part of the operating system) which saves the current state of the interrupted program. The requests are then serviced and control is given back to the interrupted program. This mechanism is called an exception.

u Exceptions come in two varieties  Interrupts are generated by hardware  I/O device  Clock  Power down  Traps are generated by code execution  Division by zero  Illegal memory address  System call Software: Interrupt Driven I/O

How interrupt driven I/O works.text. la $a0, A li $v0, 4 syscall..data A:.asciiz “cat” User code/data Output buffer Kernel dataDisplay

How interrupt driven I/O works.text. la $a0, A li $v0, 4 syscall..data A:.asciiz “cat” User code/data Output buffer Kernel dataDisplay c a t

How interrupt driven I/O works.text. la $a0, A li $v0, 4 syscall..data A:.asciiz “cat” User code/data Output buffer Kernel data c Display c a t

How interrupt driven I/O works.text. la $a0, A li $v0, 4 syscall..data A:.asciiz “cat” User code/data Output buffer Kernel data ca Display c a t

How interrupt driven I/O works.text. la $a0, A li $v0, 4 syscall..data A:.asciiz “cat” User code/data Output buffer Kernel data cat Display c a t

u The exception handler determines which event has caused the exception and decides what should be done based on it. u Since an exception handler can be invoked anytime, an exception handler can not have parameters nor it can return values. u It must also save register values being used by the interrupted program and restore them before returning control to the interrupted program. Exception Mechanism

Role of the Operating System u The operating system is a program that allocates and controls the use of all system resources: the processor, memory, and I/O devices. u Since there are many processes that can run concurrently, the operating system uses interrupt to allocate the processor to different processes periodically -- allowing processes to share processing time with each other. u The exception handler plus other codes used to decide what process should be executed next is called the kernel.