Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown



Similar documents
CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

CSC 2405: Computer Systems II

SYSTEM ecos Embedded Configurable Operating System

CS161: Operating Systems

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

1. Computer System Structure and Components

Operating Systems. Lecture 03. February 11, 2013

Red Hat Linux Internals

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Computer-System Architecture

Operating Systems Lecture #6: Process Management

Chapter 2: OS Overview

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Operating System Overview. Otto J. Anshus

An Implementation Of Multiprocessor Linux

Intel DPDK Boosts Server Appliance Performance White Paper

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Introduction. What is an Operating System?

COS 318: Operating Systems

Have both hardware and software. Want to hide the details from the programmer (user).

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Obj: Sec 1.0, to describe the relationship between hardware and software HW: Read p.2 9. Do Now: Name 3 parts of the computer.

Example of Standard API

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

White Paper Perceived Performance Tuning a system for what really matters

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Operating System Tutorial

Operating Systems 4 th Class

How To Understand And Understand An Operating System In C Programming

Computer Organization & Architecture Lecture #19

Chapter 1 Computer System Overview

OPERATING SYSTEM SERVICES

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Chapter 1: Introduction. What is an Operating System?

Networking Operating Systems (CO32010)

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Embedded Systems. 6. Real-Time Operating Systems

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI

Operating System Structures

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

CS 378: Computer Game Technology

Multi-core Programming System Overview

Module 1 Introduction to Information and Communication Technologies

INPUT/OUTPUT ORGANIZATION

The Microsoft Windows Hypervisor High Level Architecture

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Kernel Synchronization and Interrupt Handling

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

Computer Systems Structure Input/Output

Achieving Nanosecond Latency Between Applications with IPC Shared Memory Messaging

Linux Process Scheduling Policy

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Presentation of Diagnosing performance overheads in the Xen virtual machine environment

New Mexico Broadband Program. Basic Computer Skills. Module 1 Types of Personal Computers Computer Hardware and Software

CGL Architecture Specification

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

W4118 Operating Systems. Junfeng Yang

Storage. The text highlighted in green in these slides contain external hyperlinks. 1 / 14

Building Blocks for PRU Development

Types Of Operating Systems

Overview of Operating Systems Instructor: Dr. Tongping Liu

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

Operating System Software

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

Microprocessor & Assembly Language

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

The Bus (PCI and PCI-Express)

Operating System Structure

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

CS3600 SYSTEMS AND NETWORKS

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

INtime 4.0 Software September 2009

Computer Literacy. Hardware & Software Classification

Real Time Programming: Concepts

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Chapter 11 I/O Management and Disk Scheduling

Computer Science 4302 Operating Systems. Student Learning Outcomes

Timer, Interrupt, Exception in ARM

VxWorks Guest OS Programmer's Guide for Hypervisor 1.1, 6.8. VxWorks GUEST OS PROGRAMMER'S GUIDE FOR HYPERVISOR

A Survey of Parallel Processing in Linux

ELEC 377. Operating Systems. Week 1 Class 3

CHAPTER 2: HARDWARE BASICS: INSIDE THE BOX

I/O. Input/Output. Types of devices. Interface. Computer hardware

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Quality of Service su Linux: Passato Presente e Futuro

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Devices and Device Controllers

CSE2102 Digital Design II - Topics CSE Digital Design II

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Understanding Linux on z/vm Steal Time

1 Organization of Operating Systems

Overview and History of Operating Systems

Transcription:

Lecture 6: Interrupts CSC 469H1F Fall 2006 Angela Demke Brown

Topics What is an interrupt? How do operating systems handle interrupts? FreeBSD example Linux in tutorial

Interrupts Defn: an event external to the currently executing process that causes a change in the normal flow of instruction execution; usually generated by hardware devices external to the CPU From Design and Implementation of the FreeBSD Operating System, Glossary Key point is that interrupts are asynchronous w.r.t. current process Typically indicate that some device needs service

Why Interrupts? People like connecting devices A computer is much more than the CPU Keyboard, mouse, screen, disk drives Scanner, printer, sound card, camera, etc. These devices occasionally need CPU service But we can t predict when External events typically occur on a macroscopic timescale we want to keep the CPU busy between events Need a way for CPU to find out devices need attention

Possible Solution: Polling CPU periodically checks each device to see if it needs service takes CPU time even when no requests pending overhead may be reduced at expense of response time can be efficient if events arrive rapidly Polling is like picking up your phone every few seconds to see if you have a call.

Alternative: Interrupts Give each device a wire (interrupt line) that it can use to signal the processor When interrupt signaled, processor executes a routine called an interrupt handler to deal with the interrupt No overhead when no requests pending CPU Maskable Non-Maskable (NMI) Interrupt Controller Device Device Device Device

Intel 430HX Motherboard Programmable interrupt controller (PIC) part of the Southbridge chip Commonly 8259A chip 8 inputs, 1 output Can be chained together Newer systems use Advanced PIC (APIC) for SMP support Principle is the same (image from The Ars Technica Motherboard Guide, Dec. 2005, Jon Hannibal Stokes)

Polling vs. Interrupts Polling is like picking up your phone every few seconds to see if you have a call. Interrupts are like waiting for the phone to ring. Interrupts win if processor has other work to do and event response time is not critical Polling can be better if processor has to respond to an event ASAP May be used in device controller that contains dedicated secondary processor

Hardware Interrupt Handling Details are architecture dependent! Interrupt controller signals CPU that interrupt has occurred, passes interrupt number Interrupts are assigned priorities to handle simultaneous interrupts Lower priority interrupts may be disabled during service CPU senses (checks) interrupt request line after every instruction; if raised, then: uses interrupt number to determine which handler to start interrupt vector associates handlers with interrupts Basic program state saved (as for system call) CPU jumps to interrupt handler When interrupt done, program state reloaded and program resumes

Software Interrupt Handling Typically two parts to interrupt handling The part that has to be done immediately So that device can continue working The part that should be deferred for later So that we can respond to the device faster So that we have a more convenient execution context What does that mean?

Interrupt Context Execution of first part of interrupt handler borrows the context of whatever was interrupted Interrupted process state is saved in process structure Handler uses interrupted thread s kernel stack Have to be very careful about stack-allocated data Handler is not allowed to block Has no process structure of its own to save state or allow rescheduling Can t call functions that might block (like kmalloc) Handler needs to be kept fast and simple Typically sets up work for second part, flags that second part needs to execute, and re-enables interrupt

Software Interrupts The deferred parts of interrupt handling are sometimes referred to as software interrupts In Linux, they are referred to as bottom halves The terminology here is inconsistent and confusing What things can be deferred? Networking time-critical work copy packet off hardware, respond to hardware Deferred work process packet, pass to correct application Timers Time-critical increment current time-of-day Deferred recalculate process priorities

FreeBSD 5.2 & up All hardware devices and other interrupt events have an associated kernel thread with suitable priority First part of interrupt handling just schedules proper thread to run Interrupted thread is marked as needing reschedule High-priority handler thread is then scheduled on return from interrupt Handlers have full context, separate stack So they can block now, but they usually don t Handling is often still divided into two parts, second part is performed by a lower-priority software interrupt thread Some interrupts that have to be very fast still run entirely in interrupt context (e.g. clock interrupt handler)

Signals Software equivalent of hardware interrupts Allows process to respond to asynchronous external events Process may specify its own signal handlers or may use OS default action Defaults include Ignoring the signal Terminating all threads in the process (with or without a core dump) Stopping all threads in the process Resuming all threads in the process Provide a simple form of inter-process communication (IPC)

Basics Process structure has flags for possible signals and actions to take When signal is posted to process, signal pending flag is marked When process is next scheduled to run, pending signals are checked and appropriate action is taken Signal delivery is not instantaneous