Computer Architecture

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

Chapter 3 Basic Input/Output
Basic Input/Output INTERRUPTS (Week 5)
Computer Architecture
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
I/O Unit.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
CSCI 4717/5717 Computer Architecture
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
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.
Chapter 7 Interupts DMA Channels Context Switching.
Basic Input/Output Operations
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
INTERRUPTS PROGRAMMING
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.
MICROPROCESSOR INPUT/OUTPUT
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Chapter 3 Basic Input/Output. Chapter Outline Basic I/O capabilities of computers I/O device interfaces Memory-mapped I/O registers Program-controlled.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
بسم الله الرحمن الرحيم MEMORY AND I/O.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Computer Organization
Chapter 8 I/O.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Operating Systems Lecture 2.
Chapter 2: Computer-System Structures(Hardware)
Interrupts and exceptions
Chapter 2: Computer-System Structures
8085 Interrupts LAKSHMI.B.E..
CS501 Advanced Computer Architecture
Microprocessor Systems Design I
The process starts from the I/O device
Interrupts In 8085 and 8086.
Computer System Overview
Interrupt.
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Advisor: Prof. Gandhi Puvvada
Input/Output Organization
Chapter 8 I/O.
Computer System Overview
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
Module 2: Computer-System Structures
Processor Fundamentals
Operating Systems Lecture 2.
BIC 10503: COMPUTER ARCHITECTURE
COMPUTER PERIPHERALS AND INTERFACES
Architectural Support for OS
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Interrupts 1/18/2019.
Module 2: Computer-System Structures
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Computer System Overview
Chapter 8 I/O.
Computer System Overview
Architectural Support for OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
COMP3221: Microprocessors and Embedded Systems
Module 2: Computer-System Structures
Presentation transcript:

Computer Architecture Lecture 05 Fasih ur Rehman

Last Class Continued with Addressing Modes Indexing and Arrays Stacks Basic I/O Programmed I/O Memory Mapped I/O

Today’s Agenda Interrupts Interrupt driven I/O Interrupt Request Interrupt Service Routine Enabling and Disabling Interrupts

Interrupts Program controlled I/O Other Techniques are Processor repeatedly monitors the status flag of the device. Thus processor does not perform any useful work during polling which has to be done repeatedly. Other Techniques are Interrupt driven I/O Direct Memory Access While using interrupts, the device itself tells processor by sending a signal to the processor through the processor interrupt line Processor thus, can utilize the time to perform useful task.

Interrupts Processor is, say, executing the instruction located at address i when an interrupt occurs. Routine executed as a result of interrupt request is known as the interrupt-service routine (ISR). When an interrupt occurs, control must be transferred to the ISR. But before transferring control, the current contents of the PC (i+1), must be saved in a known location usually stack This way the execution at i+1 will resume upon return from interrupt.

Interrupts Overlap display and computing When display ready, sends an interrupt request This causes COMPUTE execution to be suspended and the interrupt routine DISPLAY to gain control DISPLAY interrupt routine executed and returns from the interrupt COMPUTE execution continued Has similarities with subroutine execution

Differences ISR & Subroutine A subroutine performs a task that is required by the calling program. Interrupt-service routine may not have anything in common with the program it interrupts. Interrupt-service routine and the program that it interrupts may belong to different users. As a result, before branching to the interrupt-service routine, not only the PC, but other information such as condition code flags, and processor registers used by both the interrupted program and the interrupt service routine must be stored. This will enable the interrupted program to resume execution upon return from interrupt service routine.

Interrupts Saving the executing program status involves memory operations. Execution of Interrupt service routine may be delayed a bit. This delay is called interrupt latency Most processors save minimal information in order to reduce interrupt latency. When a processor receives Interrupt, it must jump/branch to ISR Interrupting device must also be informed that processor has received the request This either is done by a proper acknowledge signal or by data transfer between processor and device

Interrupts ISR alters the execution sequence of currently running program. Some times this may not be desirable So processors generally have ability to enable or disable interrupts Normally ISR starts with Interrupt Disable instruction to avoid interruption from the same device Last instruction enables the interrupts

Enable or Disable Sometimes need to ensure that interrupts cannot occur May need to assign priorities e.g. high priority interrupts cannot be interrupted by low priority ones Ensure that an active request doesn’t lead to an infinite loop Interrupt routines may need to access data structures and ensure they do not get interrupted while doing so

Avoiding Infinite LOOP Can be handled by Ignoring interrupts until after 1st instruction of ISR Interrupt disable instruction is first instruction No further interrupts can occur Controlled by 1 bit in the processor-status (PS) register, when 1 will process interrupts, when 0 disables them Set to 1 after the return from interrupt instruction Processor automatically disable interrupts before starting ISR Edge triggered interrupts. Processor receives one interrupt request per activation of the hardware interrupt line

A Typical Scenario The device raises an interrupt request. The processor interrupts the program currently being executed and saves the contents of the PC and processor status registers (PS). Interrupts are disabled by clearing the IE bit in the PS to 0. The action requested by the interrupt is performed by the interrupt-service routine, during which time the device is informed that its request has been recognized, and in response, it deactivates the interrupt-request signal. Upon completion of the interrupt-service routine, the saved contents of the PC and PS registers are restored (enabling interrupts by setting the IE bit to 1), and execution of the interrupted program is resumed.

Interrupt Hardware Need to be able to handle a unknown number of possible interrupting devices INTR = INTR1 or INTR2 or … INTR n

Can multiple devices interrupt processor? How does the processor recognize which device is causing the interrupt? How does it know which ISR to execute? Can interrupts interrupt ISRs? How do we handle simultaneous interrupt requests? Simple solution Poll every possible interrupting device and check if status bit indicates something is to be done and then service it – Advantage: simple – Disadvantage: slow

Summary Interrupts Interrupt driven I/O Interrupt Request Interrupt Service Routine Enabling and Disabling Interrupts