Interrupts Hardware Software.

Slides:



Advertisements
Similar presentations
Exceptions Chapter Throwing and Catching Exceptions When a program runs into a problem that it cannot handle, it throws an exception. Exceptions.
Advertisements

Exceptions: when things go wrong. Various sources of error public static doSomething() { int i = 3.0; while(!done); { int i = false } ) Syntactic errors.
Yoshi
Exceptional Control Flow Processes Today. Control Flow Processors do only one thing: From startup to shutdown, a CPU simply reads and executes (interprets)
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling (2)
Lecture 9. 2 Exception  An exception is a unusual, often unpredictable event, detectable by software or hardware, that requires special processing occurring.
Slides prepared by Rose Williams, Binghamton University ICS201 Exception Handling University of Hail College of Computer Science and Engineering Department.
Exception Handling. 2 Two types of bugs (errors) Logical error Syntactic error Logical error occur  due to poor understanding of the problem and solution.
CSCI 4717/5717 Computer Architecture
Handling Errors with Exception (in Java) Project 10 CSC 420.
Introduction to Interrupts
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
C++ Exceptions STL Vector. Example int Quotient (int numer, int denom} { if (denom != 0) return (numer/denom); else //What to do?? }
Exception Handling. 2 Two types of bugs (errors) Logical error Syntactic error Logical error occur  Due to poor understanding of the problem and solution.
Interrupts Signal that causes the CPU to alter its normal flow on instruction execution ◦ frees CPU from waiting for events ◦ provides control for external.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 1 Computer System Overview.
Handling Exceptions in java. Exception handling blocks try { body-code } catch (exception-classname variable-name) { handler-code }
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.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
CSC 2405 Computer Systems II Exceptions Mini-Lecture Traps & Interrupts.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Exceptional Control Flow Topics Exceptions except1.ppt CS 105 “Tour of the Black Holes of Computing”
Exceptions. Why exceptions? We often strive for writing portable reusable code; we are able to detect errors, however our code may be used for many different.
1 An Exception is… An unusual, often unpredictable event, detectable by software or hardware, that requires special processing An exception handler is.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
Exception Handling How to handle the runtime errors.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
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.
Exceptions in OO Programming Introduction Errors Exceptions in Java Handling exceptions The Try-Catch-Finally mechanism Example code Exception propagation.
ECE122 L23: Exceptions December 6, 2007 ECE 122 Engineering Problem Solving with Java Lecture 24 Exceptions.
Introduction to Exceptions in Java CS201, SW Development Methods.
Garbage Collection It Is A Way To Destroy The Unused Objects. To do so, we were using free() function in C language and delete() in C++. But, in java it.
Exceptional Control Flow
Exceptions handling Try, catch blocks Throwing exceptions.
Java Exceptions a quick review….
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
Microprocessor Systems Design I
Basic Processor Structure/design
Exceptional Control Flow
Exceptional Control Flow
Interrupts In 8085 and 8086.
Why exception handling in C++?
Input/Output.
Exceptional Control Flow
Computer System Overview
YG - CS170.
CNS 3260 C# .NET Software Development
GEOMATIKA UNIVERSITY COLLEGE CHAPTER 2 OPERATING SYSTEM PRINCIPLES
Processor Fundamentals
Exceptions CSCE 121 J. Michael Moore
Exceptions Control Flow
Components of a CPU AS Computing - F451.
Exceptions handling Try, catch blocks Throwing exceptions.
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Exceptions handling Try, catch blocks Throwing exceptions.
Ninth step for Learning C++ Programming
Lecture 9.
Java Basics Exception Handling.
CMSC 202 Exceptions.
Exception Handling.
Interrupts and System Calls
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Interrupts Hardware Software

Interrupt definition Dictionary definition: stop the continuous progress of (an activity or process). Hardware interrupts are used by devices to communicate that they require attention from the operating system A software interrupt is caused either by an exceptional condition in the processor itself, or a special instruction in the instruction set which causes an interrupt when it is executed.

Simple processor design review

New Register Interrupt Register (IR) A hardware register (bits) that contains a value at all times. Silly example of a nibble IR and possible problems 0000 – No problem 0001 – Printer is out of paper 0010 – Processor is overheating 0011 – Disk drive is disconnected 0100 – Internet connection is lost

Interrupt Register (IR)

Hardware Interrupt Handler locator

Software Interrupts

What is an Exception? An exception is an event, which occurs during the execution of a program, that disrupts (interrupts) the normal flow of the program's instructions. Exceptions are a software version of interrupts

Example (file not found) void readFile() { openFile = open(“input.txt”); strings[] s = readFrom(openFile); doStuff(s); close(openFile); } Should work fine, however, what if the file input.txt is not there one day when you are running this program?

3 kinds of exceptions 1) Checked exceptions. User can anticipate Ex) file not found. 2) Error exceptions. Error that are external to the applications like hardware exceptions. 3) Runtime exception. Logic error in code and improper used of API, etc.

Class definitions for exception objects Consider the following : The Mathematical exception library might be organized like this. class Matherr { virtual void debug_print( ) const { cerr << “Math error”;} } ; class Overflow : public Matherr { } ; class Underflow : public Matherr { } ; class Zerodevide: public Matherr { } ; class overflow : public Matherr const char* op; int a1, a2: public: void int_overflow(const char* p, int a, int b) { op = p;a1= x; a2 = y;} virtual void debug_print( ) const { cerr << op << ‘(‘ << a1 << ‘,’ << a2 << ‘)’; }

Catching exceptions void f( ) { try { // some math code goes here } catch (Overflow) { // code to handle an over flow catch(Matherr) { // Handle any Matherr that is not an overflow catch(Dividezero) { // Handle any Divide by zero catch(…) { // Handle any exception not listed above Comments: the Dividezero will never run because Dividezero is a Matherr catch(…) will catch any exception object