lecture 21 Input / Output (I/O) 3 - system bus and memory (lectures revisited) - system bus and interrupts - exceptions (lecture 12 revisited)

Similar documents
COMP I/O, interrupts, exceptions April 3, 2016

Faculty of Science FINAL EXAMINATION

Input / Output. School of Computer Science G51CSA

CS 134. Operating Systems. April 8, 2013 Lecture 20. Input/Output. Instructor: Neil Rhodes. Monday, April 7, 14

COSC 243. Input / Output. Lecture 13 Input/Output. COSC 243 (Computer Architecture)

lecture 22 Input / Output (I/O) 4

OPERATING SYSTEMS CS136

Do not open this exam until instructed to do so. CS/ECE 354 Final Exam May 19, CS Login: QUESTION MAXIMUM SCORE TOTAL 115

lecture 18 cache 2 TLB miss TLB - TLB (hit and miss) - instruction or data cache - cache (hit and miss)

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

Input/Output Systems

Lecture 23. I/O, Interrupts, exceptions

Resource Management IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

Page 1, 5/4/99 8:22 PM

Interrupt: (verb) the interruption of a CPU s normal processing...using a mechanism provided for this purpose.

CPS104 Computer Organization and Programming Lecture 17: Interrupts and Exceptions. Interrupts Exceptions and Traps. Visualizing an Interrupt

THE CPU SPENDS ALMOST ALL of its time fetching instructions from memory

EEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1

Reading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1

Chapter 5 - Input / Output

18-349: Introduction to Embedded Real-Time Systems

The control of I/O devices is a major concern for OS designers

Review. Manage memory to disk? Treat as cache. Lecture #26 Virtual Memory II & I/O Intro

Interrupt/Timer/DMA 1

Unit 2 : Computer and Operating System Structure

The Operating System (OS) MicroComputer Engineering OperatingSystem slide 1!

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Review: Hardware user/kernel boundary

Module 12: I/O Systems

Hardware OS & OS- Application interface

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

Chapter 3 - Top Level View of Computer Function

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

CS370 Operating Systems

These three counters can be programmed for either binary or BCD count.

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Computer System Overview

Today: I/O Systems. Architecture of I/O Systems

2. Which of the following resources is not one which can result in deadlocking processes? a. a disk file b. a semaphore c. the central processor (CPU)

Operating Systems (1DT020 & 1TT802)

Input Output (IO) Management

CS 61C: Great Ideas in Computer Architecture Virtual Memory. Instructors: John Wawrzynek & Vladimir Stojanovic

Systems Architecture II

Part I Overview Chapter 1: Introduction

Anne Bracy CS 3410 Computer Science Cornell University

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #23 Loops: Precedence of Operators

[08] IO SUBSYSTEM 1. 1

Chapter 13: I/O Systems

Lecture 13 Input/Output (I/O) Systems (chapter 13)

Programmed I/O Interrupt-Driven I/O Direct Memory Access (DMA) I/O Processors. 10/12/2017 Input/Output Systems and Peripheral Devices (02-2)

Chapter 13: I/O Systems

CS 201. Exceptions and Processes. Gerson Robboy Portland State University

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Chapter 9: Virtual Memory

Readings, exercises: Chapter 11 (Due: 10/4) Homework keys Study group(s) Prelim 1 10/6!

The routi ne that processes an interru pt (called an interrupt handler ) needs to do a number of things.

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Computer Architecture CS 355 Busses & I/O System

OS Structure. Hardware protection & privilege levels Control transfer to and from the operating system

Chapter 13: I/O Systems

Module 12: I/O Systems

The Purpose of Interrupt

This training session will cover the Translation Look aside Buffer or TLB

INPUT/OUTPUT ORGANIZATION

Final Examination Semester 3 / Year 2008

Architectural Support for Operating Systems

CS370 Operating Systems

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

EEC 483 Computer Organization

I/O Devices. Chapter 5 Input/Output. Memory-Mapped I/O (2) Memory-Mapped I/O (1) Interrupts Revisited. Direct Memory Access (DMA) 11/26/2013

CS 31: Intro to Systems Operating Systems Overview. Kevin Webb Swarthmore College March 31, 2015

Interrupts Peter Rounce

Truth Table! Review! Use this table and techniques we learned to transform from 1 to another! ! Gate Diagram! Today!

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Digital Design Laboratory Lecture 6 I/O

HANDLING MULTIPLE DEVICES

This exam is worth 40 points, or 30% of your total course grade. The exam contains eight

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Interfacing. Introduction. Introduction Addressing Interrupt DMA Arbitration Advanced communication architectures. Vahid, Givargis

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University


I/O Systems. 04/16/2007 CSCI 315 Operating Systems Design 1

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

CSCI-375 Operating Systems

CSC227: Operating Systems Fall Chapter 1 INTERRUPTS. Dr. Soha S. Zaghloul

Traps, Exceptions, System Calls, & Privileged Mode

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal)

-Device. -Physical or virtual thing that does something -Software + hardware to operate a device (Controller runs port, Bus, device)

CSC 2405: Computer Systems II

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Microprocessors & Interfacing

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi

CS61C : Machine Structures

Transcription:

lecture 21 Input / Output (I/O) 3 - system bus and memory (lectures 16-18 revisited) - system bus and interrupts - exceptions (lecture 12 revisited) Wed. March 3, 2016

Let's review what happens when there is a TLB miss. In particular, what happens on the system bus?

First, recall from lecture 18 TLB hit miss TLB miss handler checks page table in main memory. Is the desired word in main memory? yes no TLB "refill" page fault

TLB Now think about how each step requires access to the system bus. hit miss Transfer entry from the page table in main memory to CPU. Is desired word in main memory? yes no TLB "refill" - CPU page swap command - page swap (DMA) - interrupt (HDD to CPU)

lecture 21 Input / Output (I/O) 3 - system bus and memory (lectures 16-18 revisited) - interrupts (and system bus) - exceptions (lecture 12 revisited) Wed. March 3, 2016

Recall from last lecture (system bus intro) - polling CPU to I/O #n: "are you ready? are you ready?..." - direct memory access (DMA) CPU to I/O #n: "use the bus to do X, and tell me when you are done"

(External) Interrupts I/O device to CPU: "stop what you are doing and do Y" e.g. keyboard (echo/render to display, d<enter> causes action) mouse (render to display) printer (out of paper, render message to user) - interrupt request (IRQ) lines are used to make requests (not system bus) Similar general idea as with DMA. But there are important differences.

General questions about interrupt requests -How does an I/O device make an interrupt request? -How to coordinate multiple I/O devices that may all make interrupt requests? Can one device interrupt another? -What does the CPU do when it gets an interrupt request? Let's examine the first two questions. I'll look at three methods.

1) each I/O device has its own IRQ, IACK lines (similar in flavour to BR/BG in DMA) Disadvantages: - many lines - places burden entirely on CPU to decide on priorities

2.) shared IRQ + polling Disadvantage: - burden still on CPU to decide whether to handle the interrupt (based on priority) "was it you #1?" "was it you #2?",...

3. Daisy Chain No, I don't know the historical origins of this term in bus design.

3.) Daisy Chain (priority ordering = physical ordering)

The key advantage of daisy chaining is that the I/O controllers (not the CPU) decide on priorities of interrupt requests. HOW? If the CPU is available then it allows the I/O device to use the bus to make an interrupt request.

Suppose all IRQ signals are initially 0.

Suppose IRQ 2 makes an interrupt request IRQ 2 = 1 : "knock, knock" IACK = 1 : "who is there?" (and CPU frees up system bus temporarily)

I/O device 1 observes IACK change from 0 to 1. If device 1 made the interrupt request, then it uses the system bus to communicate with CPU (and it passes a 0 to the next device controller). else it sets to 1 the signal to the next I/O device controller.

More generally... I/O device controller n I/O device n observes its IACK in change from 0 to 1. If device n made the interrupt request, then it sets its IACK out to 0, and uses the system bus to communicate with CPU. Otherwise it sets its IACK out to 1.

IRQ = 1 : "knock, knock" (recall OR gate) IACK = 1 (CPU) : "who is there?" (and CPU frees up system bus) IACK gets passed down to highest priority device that initiated IRQ. I/O device n : "its me, device n" (on system bus) IACK (CPU) = 0, "go away, you are not important enough" 1, "yes, what can I do for you?"

A higher priority device can interrupt a lower priority device. How? Q: How does I/O device 1 interrupt I/O device 2? A: I/0 device 1 sets its IACK out to 0 I/0 device 2 wraps up and sets IRQ2 to 0. Tries again later.

A lower priority device cannot interrupt a lower priority device. Why not? Q: Why can't I/O device 3 interrupt I/O device 2? A: IRQ3 goes through the same OR gate as IRQ2. I/O is not allowed to write onto system bus until it sees IACK in go from 0 to 1 (indicating bus has been freed up)

General questions about interrupt requests How does an I/O device make a request? How to coordinate multiple I/O devices that may all make interrupt requests? Can one device interrupt another? What does the CPU do when it gets an interrupt request? - now think MIPS - interrupt request may be from an I/O device (external interrupt), or from a CPU exception (internal interrupt).

Program jumps to exception handler in the kernel. Here we have a more general notion of interrupt, which can include both external interrupts (I/O, just discussed) and internal interrupts ("exceptions" such as overflow, division by 0, bad Address, timer = 0).

Interrupt handler Decide if the interrupt should be handled (sketched in a few slides) If yes, - disable all interrupts - save state of current process (store register values in kernel memory) - enable higher priority interrupts only - service the interrupt - possibly run other processes - restore the state of the process and return to it

Note there are TWO reasons why an interrupt might be ignored: - the CPU is currently handling a higher priority interrupt - the CPU is handling a lower priority interrupt BUT it needs to finish saving state information, before that interrupt itself can be interrupted.

Recall coprocessor 0 (lecture 12) In particular, $12 is the status register bit 0 of $12 is "interrupt enable"

MIPS registers

# enable interrupts mfco $k0, $12 # $12 is Status (on coprocessor 0) ori $k0, $k0, 0x01 # turn on only LSB mtc0 $12, $k0 # disable interrupt mfco $k0, $12 lui $1, 0xffff ori $1, $1, 0xfffe (turn off LSB of $12) and $k0, $k0, $1 mtc0 $12, $k0

status register enables/disables different priority interrupts cause register specifies which priority interrupt has occured

I am omitting many nasty details here. The main idea is that the kernel program in MIPS needs to compare bits in the cause and status registers of c0 to determine whether the interrupt should be handled or not.

Announcements - A3 should be graded by weekend - Final exam is multiple choice (48 questions). Answer all questions. If you are unsure, then rule out as many choices as you can and guess on the rest. Binomial distribution (N = 48, p = 0.2) for pure guessing on every question. e.g. There is a ~65% probability of getting a score of 8 or more out of 48 by blind guessing. Note that if you can rule out just a few of the five choices on each question, then guessing on the remaining ones will give a much higher score.

I will attempt to use the following method to calculate your exam score. (The rescaling is to compensate for blind guessing.) your score = number correct - 8 * 50 40 e.g. 28 correct answers out of the 48 questions would give a score of 25 / 50 (50%). If this method gives scores overall that are too low, then I will replace the constant 8 by a smaller one, perhaps even as small as 0 if that's what I need to do to get a roughly B- to B grade average.