interrupts in computers jhby hyuuby yubyb ubiubi ii .pptx

shahidsultan14 14 views 15 slides Mar 07, 2025
Slide 1
Slide 1 of 15
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15

About This Presentation

interrupts computer architecture


Slide Content

Interrupts How peripherals notify the CPU that their state just changed. Example: A button just pressed

Interrupts Definition 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. Key point is that interrupts are asynchronous w.r.t . current process Typically indicate that some device needs service Slides from Angela Demke Brown CSC 469H1F

Why interrupts? MCUs have many external peripherals Keyboard, mouse, screen, disk drives, scanner, printer, sound card, camera, etc. These devices occasionally need CPU service But we can’t predict when We want to keep the CPU busy (or asleep) between events Need a way for CPU to find out devices need attention Slides from Angela Demke Brown CSC 469H1F

Possible Solution: Polling CPU periodically checks each device to see if it needs service “Polling is like picking up your phone every few seconds to see if you have a call. …” Slides from Angela Demke Brown CSC 469H1F

Possible Solution: Polling CPU periodically checks each device to see if it needs service “Polling is like picking up your phone every few seconds to see if you have a call. …” Cons: takes CPU time even when no requests pending Pros: can be efficient if events arrive rapidly Slides from Angela Demke Brown CSC 469H1F

Alternative: Interrupts Give each device a wire (interrupt line) that it can use to signal the processor

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

How do interrupts work? Peripheral 2 Peripheral 3 Peripheral 4 Peripheral 1 Interrupt  Clear interrupt  Peripheral P sends int X  ACK P’s int X  Execute P’s X handler  ACK P’s int X Interrupt controller What is the benefit of having a separate controller for interrupts? CPU

CPU execution of interrupt handlers INTERRUPT Wait for instruction to end Push the program counter to the stack Push all active registers to the stack Jump to the interrupt handler in the interrupt vector Pop the program counter off of the stack

Types of Interrupts Generally Interrupts are of Two types. Hardware Interrupts Software Interrupts

Hardware Interrupt If the signal for the processor is from external device or hardware it is called hardware interrupts. Example:  Keystroke(pressing of key on keyboard) and mouse movements cause hardware interrupts Mask-able Interrupt : The hardware interrupts which can be delayed when a much highest priority interrupt has occurred to the processor. Non Mask-able Interrupt: The hardware which cannot be delayed and should process by the processor immediately.

Software Interrupt A software interrupt is a type of interrupt that is caused either by a special instruction in the instruction set or by an exceptional condition in the processor itself. Example: It is generated when divide a number by zero, accessing unavailable memory . Normal Interrupts: The interrupts which are caused by the software instructions are called software instructions. Exception: Unplanned interrupts while executing a program is called Exception. For example: while executing a program if we got a value which should be divided by zero is called a exception.

Instruction Cycle A program residing in the memory unit of a computer consists of a sequence of instructions. These instructions are executed by the processor by going through a cycle for each instruction . Fetch instruction from memory. Decode the instruction. Read the effective address from memory. Execute the instruction.

Distributed Operating System A Distributed Operating System refers to a model in which applications run on multiple interconnected computers, offering enhanced communication and integration capabilities.
Tags