3.3.1.2 Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

CSCI 4717/5717 Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
1 Computer System Overview OS-1 Course AA
1 CSIT431 Introduction to Operating Systems Welcome to CSIT431 Introduction to Operating Systems In this course we learn about the design and structure.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
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:
Introduction to Embedded Systems
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Interrupts Signal that causes the CPU to alter its normal flow on instruction execution ◦ frees CPU from waiting for events ◦ provides control for external.
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.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
MICROPROCESSOR INPUT/OUTPUT
THE COMPUTER SYSTEM. Lecture Objectives Computer functions – Instruction fetch & execute – Interrupt Handling – I/O functions Interconnections Computer.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Interrupts, Buses Chapter 6.2.5, Introduction to Interrupts Interrupts are a mechanism by which other modules (e.g. I/O) may interrupt normal.
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 Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
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.
Chapter 6: Computer Components Dr Mohamed Menacer Taibah University
Lecture 1: Review of Computer Organization
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Chapter 3 : Top Level View of Computer Functions Basic CPU function, Interconnection, Instruction Format and Interrupt.
Structure and Role of a Processor
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
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.
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
Interrupts and exceptions
MICROPROCESSOR BASED SYSTEM DESIGN
Microprocessor Systems Design I
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
Timer and Interrupts.
Advanced OS Concepts (For OCR)
Computer Architecture
Chapter 3 – Process Concepts
Interrupts In 8085 and 8086.
Input/Output.
Introduction of microprocessor
Computer System Overview
Chapter 3 Top Level View of Computer Function and Interconnection
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
The slides must be understood in Lecture 5
Computer System Overview
ECEG-3202 Computer Architecture and Organization
Processor Fundamentals
11.1 Interrupt Mechanism, Type, and Priority
Process Description and Control
BIC 10503: COMPUTER ARCHITECTURE
COMPUTER PERIPHERALS AND INTERFACES
Architectural Support for OS
Components of a CPU AS Computing - F451.
Computer System Overview
Computer System Overview
Architectural Support for OS
A Top-Level View Of Computer Function And Interconnection
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

3.3.1.2 Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical sources of interrupts should be identified and any algorithms and data structures should be described).

Interrupts Interrupt An interrupt is a signal from a device (or other source such as a running program) to request processing time from the CPU. An interrupt will cause a break in the execution of the current routine. Virtually all computers provide a mechanism by which a program currently being executed may be interrupted by another process that has an important need for processor time – the process that requires the attention sends an interrupt signal to the processor along one of the control lines. When the processor receives an interrupt, it temporarily suspends the execution of the current program and control of the processor is passed to an interrupt service routine (also known as a handler) – the currently executing program is suspended in such a way that its execution can be resumed without error after the interrupt has been ‘handled’.

Classification of interrupts Interrupts are classified by their source. The most common classes of interrupts are: Program Generated by some condition that occurs as a result of an instruction execution such as arithmetic overflow, division by zero and an illegal memory access (an attempt to use memory that is outside a user’s allowed memory space) Timer Generated by the timer within the processor. This allows the operating system to perform certain functions at regular intervals I/O Generated by an I/O controller (i.e. a peripheral), to signal: input from a user (e.g. a key press or mouse click); completion of an operation (e.g. file transferred, printing completed) an error condition (e.g. printer out of paper); Hardware failure Generated by a failure of a device such as a hard disk or by a memory parity error. A parity error was detected within the system memory. Parity checking is used to detect memory corruption between the time that data is written to memory and the time that it is read back. This error message means that there is a problem associated with the system memory. Depending on the system, you may be told some specifics about what part of memory caused the error. Diagnosis: There are many possible causes of memory parity errors, some of them only related indirectly to the memory, or even having nothing to do with the memory at all. In particular, a memory error at start up is often indicative of a wide variety of possible problems. Recommendation: Diagnose the parity error further here.

Priority of interrupts Some interrupts are for conditions that need immediate attention (e.g. hard disk failure) and others are for conditions that may be ignored for a while (e.g. printer running out of paper). It is, therefore, necessary to assign a priority to each type of interrupt so that when two or more interrupts occur at the same time, the processor can compare interrupt priorities to determine which one to process first. If an interrupt is already being serviced when another interrupt occurs, then interrupts of equal or lower priority must await the completion of the current one. Only an interrupt of a higher priority is allowed to interrupt the servicing of another. In the case of two or more interrupts occurring simultaneously the interrupts are serviced in order of priority. Interrupts caused by hardware failure are given the highest priority in order to protect against data loss.

Examples of interrupt priorities The interrupts with a priority of 1 or 2 must never be ignored; it is not possible for a programmer to disable these interrupts. But some programs disable the keyboard interrupt while they are executing to prevent a process from being cancelled.

Interrupt handling The processor checks for interrupts at the end of every Fetch-Execute cycle. If an interrupt has occurred, it is ‘handled’ and then the processor returns to where it left off:

Interrupt handling Interrupt requests When a device is installed, it is assigned an Interrupt Request (IRQ) number. This number is used when a device wants the attention of the processor: The device (or process) generates an interrupt signal This is sent to the processor along one of the control lines The interrupt flag in the status register is set The IRQ number of the device (or process) is stored in the interrupt register.

Interrupt handling Identifying the interrupt A typical sequence of actions when an interrupt occurs would be: The fetch-execute cycle is completed; The interrupt register is checked to identify the source of the interrupt; The priority of the current task is compared with the priority of the interrupt; If the interrupt has a higher priority: Interrupts of a lower priority are disabled; The interrupt is serviced…

Interrupt handling Servicing the interrupt Each different type of interrupt is associated with a specific Interrupt Service Routine (ISR), also called an interrupt handler – these are the routines that are executed when an interrupt occurs. For example, when you press a key on your keyboard, this triggers the keyboard interrupt handler. This handler will execute, perform its action and then pass back control of the processor to the program that was executing before the interrupt occurred. The complete list of interrupts and their interrupt handlers is stored in a table called the interrupt vector table, which is stored in the first 1 Kbyte of addressable memory.

Interrupt handling Servicing the interrupt The current contents of the program counter, is placed on ‘the stack’; The contents of the other registers are placed on ‘the stack’; The address of the interrupt service routine is obtained and put into the program counter; The interrupt service routine is executed; There is a check for further interrupts… …which are serviced if they have a higher priority that the previously suspended task; Otherwise… … the saved register values (other than the program counter) are restored from the stack; The program counter is restored from the stack and execution of the original task is resumed.