CS 141 ChienMay 26, 1999 Interrupt-Driven Input/Output u Last Time –Busses, Arbitration, Interoperability –Polled Input/Output Operations –Inefficiencies.

Slides:



Advertisements
Similar presentations
CPU Structure and Function
Advertisements

Computer Architecture
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
计算机系 信息处理实验室 Lecture 3 System Mechanisms (1)
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 10 Input/Output Organization. Connections between a CPU and an I/O device Types of bus (Figure 10.1) –Address bus –Data bus –Control bus.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
Process Description and Control
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
1 Computer System Overview OS-1 Course AA
OS Spring’03 Introduction Operating Systems Spring 2003.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
CHAPTER 9: Input / Output
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
CS-334: Computer Architecture
Introduction to Embedded Systems
COMP201 Computer Systems Exceptions and Interrupts.
Interrupts Signal that causes the CPU to alter its normal flow on instruction execution ◦ frees CPU from waiting for events ◦ provides control for external.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
CHAPTER 9: Input / Output
MICROPROCESSOR INPUT/OUTPUT
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
I/O Interfacing A lot of handshaking is required between the CPU and most I/O devices. All I/O devices operate asynchronously with respect to the CPU.
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
The Stack This is a special data structure: –The first item to be placed into the stack will be the last item taken out. Two basic operations: –Push: Places.
COMPUTER ORGANIZATIONS CSNB123. COMPUTER ORGANIZATIONS CSNB123 Expected Course Outcome #Course OutcomeCoverage 1Explain the concepts that underlie modern.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
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.
L/O/G/O Input Output Chapter 4 CS.216 Computer Architecture and Organization.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
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,
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
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.
Copyright © 2007 by Curt Hill Interrupts How the system responds.
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
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.
1 Computer System Overview Chapter 1. 2 Operating System Exploits the hardware resources of one or more processors Provides a set of services to system.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
CS501 Advanced Computer Architecture
Operating Systems CMPSC 473
Microprocessor Systems Design I
Timer and Interrupts.
Interrupts In 8085 and 8086.
Intro to Processes CSSE 332 Operating Systems
Real-time Software Design
Computer System Overview
BIC 10503: COMPUTER ARCHITECTURE
Process Description and Control
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Process Description and Control
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
Computer System Overview
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

CS 141 ChienMay 26, 1999 Interrupt-Driven Input/Output u Last Time –Busses, Arbitration, Interoperability –Polled Input/Output Operations –Inefficiencies u This Time –Interrupts –Interrupt-Driven I/O –Serial and Block Device Examples u Reminders/Announcements –Reading P&H, Chapter –Next week, 6/4 Course Review –Final Exam, 6/7, 8-11am (location tbd) –HW4 due on 6/4 (in class)

CS 141 ChienMay 26, 1999 Exceptions and Interrupts u Exceptions cause a control transfer to an exception handler in response to an unusual event. –Ex. floating point overflow, memory addressing error, segmentation fault, etc. u This control transfer looks like a “Dynamic Procedure call” u Exceptions are caused by the executing instruction(s) –Happen “at a particular instruction” –One handler for each exception, “vectored exceptions” u Handler decodes the exception based on stored status info (PC, exception register, etc.), and performs appropriate action

CS 141 ChienMay 26, 1999 Interrupts u Interrupts = “externally caused exceptions” u Dynamic Procedure call (same as an internal exception) u Have NOTHING to do with current execution, not synchronized with instruction stream, so delays can be tolerated. u Interrupt -> “interrupts” what the processor is doing Interrupt Processor Exception

CS 141 ChienMay 26, 1999 Interrupt Example u External Device causes interrupt u Executing code is stopped, dynamic procedure call –Delay doesn’t matter much u State is saved (as with an exception), control is passed to the “interrupt handler” u After servicing interrupt, control returned to previously running program Processor Interrupt Controller I/O Device inst0 inst1 inst2 inst3 inst4... ihandler:instA instB instC rte

CS 141 ChienMay 26, 1999 Using Interrupts for Input/Output u Why are interrupts useful? –External analogy to exceptions –Allow response to unusual external events without inline overhead (polling). u Idea: Use interrupts to reduce polling overhead for Input/output –Processor initiates I/O operation –Device interrupts processor when its ready –Interrupt handler transfers data into the memory –Control returned to currently executing program u Analogous schedule for output operations u Polling overhead vs. Interrupt handling cost

CS 141 ChienMay 26, 1999 Advantages &Complications u Advantages –Reduced polling time vs. interrupt cost –Improved program modularity (no more polling code) –Preserves the ability of old programs to run in new configurations u Complications –Additional hardware required (interrupt controller, etc.) –How to deal with several devices? –What if more than one interrupt occurs at once? u We’ll deal with these questions next.

CS 141 ChienMay 26, 1999 Multiple sources of Interrupts u How to determine which device caused the interrupt? –Single device per priority –Devices place their ID number on the address bus –Processor polls devices to find out which caused the interrupt –Interrupt Handler -> reads some hardware status registers to determine the source of the interrupt u How to handle an interrupt within an interrupt? –Many systems don’t; disable interrupts when within an interrupt handler –Some systems have interrupt priorities, while in an interrupt handler; only a higher priority interrupt will be handled

CS 141 ChienMay 26, 1999 Interrupt Handler Structure u Disable Interrupts u Determine device causing interrupt u Do appropriate processing u Enable Interrupts u What does the stack look like during the interrupt? –stuff on stack before interrupt –stack frame for the interrupt handler? Special return instruction (rte) –when can you allocate stack frame memory? (when is it safe?) inthandler: disableInts lw $2,device($0)... do the work... enableInts rte

CS 141 ChienMay 26, 1999 Interrupts and Response Time u Lower numbers are “higher priority” u How should we assign priorities to devices? –Latency is critical for some devices. –Ordering can have big impact on latency. u Assume non-preemptive priority system. –Interrupts cannot be interrupted. –Pending interrupts are processed in order of priority. Device NumberInterrupt Priority

CS 141 ChienMay 26, 1999 Guaranteed Maximum Latency Guaranteed Maximum ( I )= MAX(service time of devices at I) Latency+ SUM(service time of devices with greater priority) Device NumberInterrupt PriorityServiceGuar. Max. Latency

CS 141 ChienMay 26, 1999 Real-Time Systems (Embedded systems) u Timeliness of response is fundamental requirement of system design –Control (cars, airplanes, manufacturing) –Instrumentation (measurement, data capture) –Tracking, Guidance (military apps) –Otherwise, system fails! u Real-Time requirements fundamentally affect the nature of system design.

CS 141 ChienMay 26, 1999 Interrupt-Driven I/O (Overview) u Processor sets up I/O operation, continues its work u Device performs I/O (a long time) u Device completes, interrupts the processor u Processor responds to interrupt, transfers the data u I/O is complete. u => Interrupts save overhead of polling. PMem I/O Memory Bus I/O Bus

CS 141 ChienMay 26, 1999 Summary u Interrupts as external exceptions u Interrupt Handling u Motivation for Interrupt-Driven Input/Output u How Interrupt-Driven Input/Output works u Next time: How to make I/O even more efficient (DMA)! u Where is there still overhead? (data movement) –Size of data transfers? Cost?