Copyright © 2007 by Curt Hill Interrupts How the system responds.

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Advertisements

CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Computer Organization and Architecture
Computer Organization and Architecture
CSCI 4717/5717 Computer Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Lecture Objectives: 1)Explain the limitations of flash memory. 2)Define wear leveling. 3)Define the term IO Transaction 4)Define the terms synchronous.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
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.
Exception Processing ECE511: Digital System & Microprocessor.
1 Computer System Overview OS-1 Course AA
Chapter 7 Interupts DMA Channels Context Switching.
Basic Input/Output Operations
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
1 COMP541 Interrupts, DMA, Serial I/O Montek Singh April 24, 2007.
Exceptions, Interrupts & Traps
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
CH12 CPU Structure and Function
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.
Interrupts. 2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose:
COMP201 Computer Systems Exceptions and Interrupts.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
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.
MICROPROCESSOR INPUT/OUTPUT
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
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.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
I/O management is a major component of operating system design and operation Important aspect of computer operation I/O devices vary greatly Various methods.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
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.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
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.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
بسم الله الرحمن الرحيم 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.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
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.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Computer System Structures Interrupts
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Computer Architecture
Computer System Overview
Chapter 11 Processor Structure and function
Presentation transcript:

Copyright © 2007 by Curt Hill Interrupts How the system responds

Connection I/O devices can be connected through I/O ports to the CPU The number of ports is determined by the number of bits, used to access them These I/O ports are usually signified by address lines on the bus Copyright © 2007 by Curt Hill

Communication The CPU can communicate with these ports with a few commands The CPU can request a status code which indicates that status of the device, usually idle or busy Other commands include read data or write data Copyright © 2007 by Curt Hill

Time delays Most I/O devices are incredibly slow compared to a CPU Eg a disk may have a 13ms access time, which is not bad Yet even old computers had instruction times of less than a micro second or is times faster Why should the CPU sit idle while it could execute thousands of instructions while the disk is doing its thing Copyright © 2007 by Curt Hill

Interrupts Very early on it was seen as desirable to overlap instruction and I/O time We then have a synchronization problem that takes one of two forms Both types are solved by interrupts Copyright © 2007 by Curt Hill

Synchronization The CPU may have to get involved when memory is accessed, that is the data is read or written If the CPU does not have to assist in the access of memory, then it still must be notified that something has happened, thus the process that was stalled by an I/O request can now be restarted Copyright © 2007 by Curt Hill

Definition A quick change in the processing of the CPU An interrupt must be attended to on a quick basis Yet it comes at unpredictable times, we do not wait for it We must be able to re-establish whatever process was executing when the interrupt occurred in a transparent way –That is the process should be unable to tell that it had been interrupted and restarted Copyright © 2007 by Curt Hill

Process An interrupt is started by the raising of an interrupt signal –This is usually by a bus control line changing state This must be recognized and responded to There can be multiple interrupts –Must also have an interrupt code that captures what is happening Copyright © 2007 by Curt Hill

Example A key being clicked generates a different interrupt than a disk read to read or write The interrupts may also be prioritized –Disks have much lower latency Copyright © 2007 by Curt Hill

CPU Support The CPU often has an interrupt register used in conjunction with this signal or code Usually it is the case that once this interruption occurs the CPU finishes its current instruction and then deals with the interrupt Copyright © 2007 by Curt Hill

Fetch Execute Part of the fetch execute cycle is dealing with interrupts Some instructions may be so long that they are designed to be interruptible –Eg 370 MVCL which could transfer thousands of bytes in memory –The String instructions of x86 Copyright © 2007 by Curt Hill

Interrupt handlers A routine that deals with the interrupt The goal of an interrupt handler is to: –Save the status of the CPU –Service the interrupt –Restore the CPU and re-execute the process that was in control before Very often interrupt handlers are partially loaded in low memory and elsewhere There usually exists an interrupt table Copyright © 2007 by Curt Hill

Interrupt table This maps the kinds of interrupts to their respective handlers This may be very simple or complicated Simple –Each interrupt is given so many bytes in lowest memory, usually just enough to call the real routine –The interrupt number is multiplied by a constant –This becomes an executable address Copyright © 2007 by Curt Hill

Example for x86 Each routine is 16 bytes Then interrupt zero branches to location 0, interrupt 1 to address 16, 2 to 32 etc. This is easy to make the interrupt number into an address That code was usually a call to a BIOS routine in DOS Which ever OS you ran loaded the lower so many bytes of memory with the addresses of its interrupt handlers Copyright © 2007 by Curt Hill

Kinds of interrupts Critical hardware faults –The power supply just notified us that it lost power –The capacitors will keep us up for a second or two I/O interrupts –A disk is positioned Errors of a less important nature –Divide by zero Service request –Request for an I/O operation to occur Copyright © 2007 by Curt Hill

Maskable interrupts Suppose that you are servicing a disk interrupt and a keyboard interrupt occurs Do you process the newer one even though it is less important or time constrained? –Not usually Instead you set the interrupt mask Copyright © 2007 by Curt Hill

Masked interrupts This mask blocks out lower priority interrupts So an interrupt can only be interrupted by an interruption of higher priority than it Usually the first action of an interrupt is to mask out less important interrupts Copyright © 2007 by Curt Hill

Saving registers One of the universally seen benefits of a stack, is that it is a nice place to save register contents Most interrupt handlers save the CPU registers on a stack at the outset, then do their processing and finally restore them on the stack Some CPUs may have this automatically done as part of processing an interrupt Copyright © 2007 by Curt Hill

Stack Saving registers on the stack works well –If the stack does not overflow Recall the PowerPC has a two stack pointers, one for the user and one for the system –An interrupt puts us in system mode so we save the contents of the registers on the system stack and do not have to worry about disturbing user space Copyright © 2007 by Curt Hill