1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 19: I/O, Interupsi 20 November 2002 Bobby Nazief Johny Moningka

Slides:



Advertisements
Similar presentations
Chapter 6 I/O Systems.
Advertisements

Chapter 8 Interfacing Processors and Peripherals.
Computer Architecture
Categories of I/O Devices
计算机系 信息处理实验室 Lecture 3 System Mechanisms (1)
1  1998 Morgan Kaufmann Publishers Interfacing Processors and Peripherals.
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.
Input and Output CS 215 Lecture #20.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
I/O Unit.
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
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
Processes 1 CS502 Spring 2006 Processes Week 2 – CS 502.
Chapter 7 Interupts DMA Channels Context Switching.
Basic Input/Output Operations
Computer System Organization S H Srinivasan
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.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
Midterm Wednesday 11/19 Overview: 25% First Midterm material - Number/character representation and conversion, number arithmetic - DeMorgan’s Law, Combinational.
COMPUTER SYSTEMS An Integrated Approach to Architecture and Operating Systems Chapter 4 Processor Implementation ©Copyright 2008 Umakishore Ramachandran.
1 IKI10230 Pengantar Organisasi Komputer Bab 4.1: Input/Output & Interrupt 19 Maret 2003 Bobby Nazief Qonita Shahab
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
3/11/2002CSE Input/Output Input/Output Control Datapath Memory Processor Input Output Memory Input Output Network Control Datapath Processor.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
MICROPROCESSOR INPUT/OUTPUT
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
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.
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.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
DMA Versus Polling or Interrupt Driven I/O
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Computers Internal Communication. Basic Computer System MAIN MEMORY ALUCNTL..... BUS CONTROLLER Processor I/O moduleInterconnections BUS Memory.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
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.
Lecture 4-1 I/O Organization I/O Accesses Interrupt in general Next Lecture   ARM Interrupt   DMA.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CS2100 Computer Organisation Input/Output – Own reading only (AY2015/6) Semester 1 Adapted from David Patternson’s lecture slides:
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
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.
بسم الله الرحمن الرحيم MEMORY AND I/O.
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
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.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Interrupts and exceptions
Microprocessor Systems Design I
Computer Architecture
Chapter 10 The Stack.
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 19: I/O, Interupsi 20 November 2002 Bobby Nazief Johny Moningka bahan kuliah: Sumber: 1. Hamacher. Computer Organization, ed Materi kuliah CS61C/2000 & CS152/1997, UCB.

2 What is the alternative to polling? °Wasteful to have processor spend most of its time “spin-waiting” for I/O to be ready °Wish we could have an unplanned procedure call that would be invoked only when I/O device is ready °Solution: use interrupt mechanism to help I/O. Interrupt program when I/O ready, return when done with data transfer

3 I/O Interrupt °An I/O interrupt is like a subroutine call except: An I/O interrupt is “asynchronous” More information needs to be conveyed °An I/O interrupt is asynchronous with respect to instruction execution: I/O interrupt is not associated with any instruction, but it can happen in the middle of any given instruction I/O interrupt does not prevent any instruction from completion

4 Interrupt Driven Data Transfer (1) I/O interrupt (2) save PC (3) interrupt service addr Memory add sub and or user program read store... jr interrupt service routine (4) (5)

5 Instruction Set Support for I/O Interrupt °Save the PC for return AVR uses the stacks °Where go when interrupt occurs? AVR defines: -Locations 0x000 – 0x002 for external interrupts -Locations 0x003 – 0x00C for internal interrupts °Determine cause of interrupt? AVR uses vectored interrupt, which associates the location of the interrupt service routine (see above) with the device that causes it

6 Benefit of Interrupt-Driven I/O °400 clock cycle overhead for each transfer, including interrupt. Find the % of processor consumed if the hard disk is only active 5% of the time. °Interrupt rate = polling rate Disk Interrupts/sec = 8 MB/s /16B = 500K interrupts/sec Disk Transfer Clocks/sec = 500K * 400 = 200,000,000 clocks/sec % Processor for during transfer: 250*10 6 /500*10 6 = 40% °Disk active 5%  5% * 40%  2% busy  Determined by disk’s activity, whereas in Polling- driven I/O the Processor will be busy polling 40% of the time even if the disk is not active

7 Multiple Devices/Interrupts °Which I/O device caused exception? Needs to convey the identity of the device generating the interrupt °Can avoid interrupts during the interrupt routine? In general, interrupts are disabled whenever one is being serviced; interrupts will be enabled after the service is completed What if more important interrupt occurs while servicing this interrupt? °Who keeps track of status of all the devices, handle errors, know where to put/supply the I/O data? In general, these is one of the tasks of Operating System

8 Device Identification CPU Device 1 Device N Device 2 INTR1 °The Interrupting Device may provide its identity through: Interrupt-Request (IRQ) bit in its Status Register, which will be evaluated one-by-one by the processor (polling) Sending special code the the processor over the bus (vectored interrupt) INTRn INTR2 wired-OR

9 Prioritized Interrupt CPU Device 1 Device N Device 2 INTA1 INTR1 °An Interrupt Service Routine may be interrupted by other, higher-priority interrupt

10 Daisy Chain Scheme °Advantage: simple °Disadvantages: Cannot assure fairness: A low-priority device may be locked out indefinitely CPU Device 1 Highest Priority Device N Lowest Priority Device 2 INTA Release INTR wired-OR

11 Exceptions °Interrupt is only a subset of Exception Exception: signal marking that something “out of the ordinary” has happened and needs to be handled °Interrupt: asynchronous exception Unrelated with instruction being executed °Trap: synchronous exception Related with instruction being executed To recover from errors: Illegal Instruction, Divide By Zero, … To debug a program To provide privilege (for Operating System)

12 4 Responsibilities leading to OS °The I/O system is shared by multiple programs using the processor °Low-level control of I/O device is complex because requires managing a set of concurrent events and because requirements for correct device control are often very detailed °I/O systems often use interrupts to communicate information about I/O operations °Would like I/O services for all user programs under safe control

13 4 Functions OS must provide °OS guarantees that user’s program accesses only the portions of I/O device to which user has rights (e.g., file access) °OS provides abstractions for accessing devices by supplying routines that handle low-level device operations °OS handles the exceptions generated by I/O devices (and arithmetic exceptions generated by a program) °OS tries to provide equitable access to the shared I/O resources, as well as schedule accesses in order to enhance system performance

14 OS Interrupt Services OSINITSet interrupt vectors Time-slice clock  SCHEDULER Trap  OSSERVICES VDT interrupts  IODATA OSSERVICESExamine stack to determine requested operation Call appropriate routine SCHEDULERSave current context Select a runnable process Restore saved context of new process Push new values for PS and PC on stack Return from interrupt SCHEDULER OSSERVICES IODATA … … PC

15 I/O ROUTINES & DEVICE DRIVER IOINITSet process status to Blocked Initialize memory buffer address pointer Call device driver to initialize device & enable interrupts in the device interface (VDTINIT) Return from subroutine IODATAPoll devices to determine source of interrupt Call appropriate device driver (VDTDATA) If END = 1, then set process status to Runnable Return from interrupt VDTINITInitialize device interface Enable interrupts Return from subroutine VDTDATACheck device status If ready, then transfer character If character = CR, then set END = 1; else set END = 0 Return from subroutine

16 Things to Remember °I/O gives computers their 5 senses °I/O speed range is million to one °Processor speed means must synchronize with I/O devices before use °Polling works, but expensive processor repeatedly queries devices °Interrupts works, more complex devices causes an exception, causing OS to run and deal with the device °I/O control leads to Operating Systems