Chapter 7 Interupts DMA Channels Context Switching.

Slides:



Advertisements
Similar presentations
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Advertisements

Computer Organization and Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Computer System Overview
Chapter 12 CPU Structure and Function. CPU Sequence Fetch instructions Interpret instructions Fetch data Process data Write data.
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
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.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
CSS 372 Lecture 1 Course Overview: CSS 372 Web page Syllabus Lab Ettiquette Lab Report Format Review of CSS 371: Simple Computer Architecture Traps Interrupts.
Computer System Overview
Chapter 9 & 10 Subroutines and Interrupts. JSR Instruction: JSR offset (11 bit) xxxxxxxxxxx [PC ]  R7, JMP Offset Jump to Subroutine at offset.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
CSS 372 Oct 2 nd - Lecture 2 Review of CSS 371: Simple Computer Architecture Chapter 3 – Connecting Computer Components with Buses Typical Bus Structure.
TCSS 372A Computer Architecture. Getting Started Get acquainted (take pictures) Review Web Page (
Midterm Wednesday 11/19 Overview: 25% First Midterm material - Number/character representation and conversion, number arithmetic - DeMorgan’s Law, Combinational.
Unit-5 CO-MPI autonomous
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
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
System Calls 1.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
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.
Chapter 1 Computer System Overview Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
MICROPROCESSOR INPUT/OUTPUT
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
2007 Oct 18SYSC2001* - Dept. Systems and Computer Engineering, Carleton University Fall SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
DMA Versus Polling or Interrupt Driven I/O
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 1 Computer System Overview.
Computers Internal Communication. Basic Computer System MAIN MEMORY ALUCNTL..... BUS CONTROLLER Processor I/O moduleInterconnections BUS Memory.
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Organisasi Sistem Komputer Materi VIII (Input Output)
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
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.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Lecture 1: Review of Computer Organization
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
بسم الله الرحمن الرحيم MEMORY AND I/O.
Multiple Interrupts Each interrupt line has a priority Higher priority lines can interrupt lower priority lines If bus mastering only current master can.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Chapter 1 Computer System Overview
Computer System Overview
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 1 Computer System Overview
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

Chapter 7 Interupts DMA Channels Context Switching

Program Model Interrupt Model Probably Hardware Service Device OS Supplied ? Service Device Programmer supplied Wait for Device Ready Command Device Interrupt ModelProgram Model Done outside of user Program

Interrupt Physical Model CPU –General Purpose Registers Program counter (PC) Stack Pointer (SP) –User stack Pointer Storage –Supervisor Stack Pointer Storage –Program Status Word (PSW) – Includes State – user/supervisor, priority, etc. Program Priority Condition Codes (CC) –Hardware to communicate over the BUS Address, Data, and Data Control Bus status and control Memory –User program –Interrupt Service Routine Program –Operating System –Interrupt Vector Table Includes an entry that points to the Interrupt Service Routine (Interrupt vector #) Device –Status/Control Register(s) – Includes: Interrupt Enable bit Interrupt bit (sometimes called ready or done) –Priority Level for Interrupt Service Routine (In hardware or firmware) –Interrupt vector number (In hardware or firmware) –Hardware to communicate with CPU over the BUS

Interface Registers Keyboard Device: Keyboard Status Register (16 bit) Bit 15 Done Bit Bit 14 Interrupt Enable Bit Bits 0-2 Priority Keyboard Data Register (16 bit) Contains character entered Keyboard Interrupt Vector (16 bit) Contains the “address” in the Interrupt Vector Table Display Device: Display Status Register (16 bit) Bit 15 Ready Bit Bit 14 Interrupt Enable Bit Bits 0-2 Priority Display Data Register (16 Bit) Contains character to be displayed Display Interrupt vector (16 bit) Contains the “address” in the Interrupt Vector Table

Interrupt Sequence 1)Programmer Action: Enable Interrupts by setting “intr enable” bit in Device Status Reg 2)Enabling Mechanism for device: When device wants service, and its enable bit is set (i.e, the I/O device has the right to request service), and the device priority is higher than the priority of the presently running program, and execution of an instruction is complete, then 4)Process to Service the Interrupt: The Processor saves the “state” of the program (must be able to return to program) The Processor goes into Privileged (or Supervisor) Mode The Priority level is set (established by the interrupting device) The context is switched The user SP is saved and the Supervisor SP loaded The (PC) and the (PSR) are PUSHED onto the Supervisor Stack The contents of the other registers are not saved. Why? The CC’s are cleared. Why? 5)The Processor Loads the PC from the Interrupt Vector Table The device provides the Vector Table entry number 6)Interrupt Service Routine is executed The routine ends with an “RTI” instruction 7)The context is switched back The stored user: PSR (POP into PSR), PC (POP into PC), USP loaded (POP into SP) The Processor goes into User mode 8) And the next instruction in the original program is fetched

Interrupt Context Switching User Stack –What goes on here Supervisor Stack –PC –SP –PSW –What about IR, GP Reg ? What about the PSW, PC, GP Reg in the Supervisor? Is the Interrupt Service Program run in User or Supervisor mode? Who can write an Interrupt service routine?

Alternatives for transferring Blocks of Data to/from an I/O device Transfer can occur under program control – perhaps with a subroutine (?) Transfer can occur with an Interrupt Service Routine – requires context switch Transfer can occur with Direct Memory Access (DMA) – In parallel or Pseudo Parallel of the Program/CPU

DMA Function Normally, the CPU is the only controller of the BUS –Reads / Writes of Data to memory –Read/Writes of Data/Status to I/O Devices DMA controller(s) takes over Bus control from CPU for I/O - Requires permission from Bus Controller (usually the CPU) –Suspends the CPU while it reads/writes data, or Cycle steals – uses BUS when it is not going to be utilized allowing the CPU to continue working (Note: this is different from Stallings’ definition) –Can read/write one word per DMA or a whole Block - Gives BUS back when finished - Typically interrupts the CPU when DMA is complete DMA requires an additional Module(s) attached to bus to provide BUS supervision when it is in control

Typical DMA Module Organization / Buffer

DMA Operation (Block Transfer) CPU provides direction to DMA controller(s) Like: –Read/Write –Device address (which device) –Starting address of memory block for data –Amount of data to be transferred –Mode(s) of data transfer When transfer begins, CPU is likely goes to sleep DMA controller deals with transfer (is BUS controller) DMA controller releases the BUS DMA controller sends an interrupt after finished What about context switching ?

DMA and Interrupt Breakpoints During an Instruction Cycle

DMA Transfer - Cycle Stealing CPU provides direction to DMA controller(s) DMA controller provides bus control for a read/write cycle when the BUS is not being used – How does it know? Transfers one word of data per cycle steal Data Transfer is slower than Block Transfer DMA, but faster than program control or using an interrupt service routine – Why? Slows done the CPU/program very little – Why ?

“Cycle Stealing” Options Stealing cycles when they aren’t going to be used anyway – when an instruction is not going to use the bus – when the cache is providing data – when a partition of memory is not likely to be accessed

Several questions What effect does caching memory have on DMA? What effect does use of DRAMs have on DMA ?

DMA Configurations (1) Single Bus, Detached DMA controller Each transfer uses bus twice –I/O to DMA then –DMA to memory CPU is suspended twice

DMA Configurations (2) Single Bus, Integrated DMA controller Controller may support >1 device Each transfer uses bus once –DMA to memory CPU may be suspended only once

DMA Configurations (3) Separate I/O Bus Bus supports all DMA enabled devices Each transfer uses bus once –DMA to memory CPU is suspended once

I/O Channels Used on large systems – systems with many devices - especially many fast devices I/O channels are processors (programmable) dedicated to I/O CPU instructs I/O controller to do transfer and provides it mode I/O controller does entire transfer from one or many devices Advantages: Makes transfers less visible to CPU, spreads the complexity Can Improve speed Can improve device organization flexibility

I/O Channel Architectures Selector Channel: For one fast device at a time Multiplexor Channel: For a number of slower devices used simultaneously