Assignment Submitted to:
Post Graduate College for Women
Interrupts in CPU
In system programming, an interrupt is a signal to the processor emitted by hardware or software
indicating an event that needs immediate attention.
An interrupt alerts the processor to a high-priority condition requiring the interruption of the
current code; the processor is executing. The processor responds by suspending its current
activities, saving its state, and executing a function called an interrupt handler (or an interrupt
service routine, ISR) to deal with the event. This interruption is temporary, and, after the interrupt
handler finishes, the processor resumes normal activities.
Types of Interrupt
There are two types of interrupts:
• Hardware Interrupts
If the signal for the processor is from external device or hardware, interrupt is called
Example: From keyboard we will press the key to do some action. This pressing of key in
keyboard will generate a signal which is given to the processor to do action, such interrupts
are called hardware interrupts. Hardware interrupts can be classified into two types they
o Maskable Interrupt: The hardware interrupts which can be delayed when a much
highest priority interrupt has occurred to the processor.
o Non Maskable Interrupt: The hardware which cannot be delayed and should
process by the processor immediately.
• Software Interrupts
Software interrupt can also be divided in to two types.
o Normal Interrupts: The interrupts which are caused by the software instructions
are called software instructions.
o Exception: Unplanned interrupts while executing a program, are called Exception.
For example: while executing a program if we got a value which should be divided by
zero is called an exception.
Classification of Interrupts According to Periodicity of Occurrence:
• Periodic Interrupt: If the interrupts occurred at fixed interval in timeline then those
interrupts are called periodic interrupts.
• Aperiodic Interrupt: If the occurrence of interrupt cannot be predicted then that
interrupt is called aperiodic interrupt.
Classification of Interrupts According to the Temporal Relationship with
• Synchronous Interrupt: If the source of interrupt is in phase to the system clock is
called synchronous interrupt. In other words, interrupts which are dependent on the system
clock. Example: timer service that uses the system clock.
• Asynchronous Interrupts: If the interrupts are independent or not in phase to the
system clock is called asynchronous interrupt.
Why Exactly there is Need to Design Interrupts in Embedded Systems?
People like connecting devices to the computer. For the computer is much more than the CPU
(Keyboard, Mouse, Screen, Disk Drivers, Sound Cards 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 which devices need attention.
Why Interrupts are Required
☼ To increase the processing speed of CPU.
What can be the Possible Solution for Interrupts?
CPU periodically checks each device to see if it needs service. This can be efficient if events
However, it takes CPU time even when no requests are pending. Moreover, overhead may be
reduced at expense of response time.
Polling is like picking up your phone after a few seconds to see if you have a call.
Give each device a wire (interrupt line) that it can use to signal the processor.
o When interrupt signaled, processor executes a routine called an interrupt handler to
deal with the interrupt.
o No overhead when no requests are pending.
Instruction execution cycle including interrupt processing
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 a phone to ring.
• Interrupts win if the processor has other work to do and event response time isn’t critical.
• Polling can be better if the processor has to respond to an event ASAP
o May be used in device controller that contains dedicated secondary processor.
1) CPU instructs printer to print.
2) While printer does its task, CPU waits for task completion.
3) User program stopped.
4) Repeated checking by CPU
5) When task done, CPU proceeds.
1) CPU instructs printer to print.
2) While printer does its task, CPU uses to engage in executing other instructions.
3) User program proceeds concurrently with printing.
4) When task done, printer tells (interrupts) CPU.
The interrupt vector table
An interrupt vector is the memory location of an interrupt handler, which prioritizes interrupts and
saves them in a queue if more than one interrupt is waiting to be handled. In short, IVs can be
called as pointers to routines that handle interrupts.
Interrupt Vector Table IVT
IVT is a table of interrupt vectors. Interrupt vector table is a global table situated at the address
0000:0000H. The size of interrupt vector table is 1024 bytes or 1 KB. Each entry in the IVT is
sized 4 bytes hence 256 interrupt vectors are possible numbered (0-FFH). Each interrupt number
is reserved for a specific purpose. An interrupt vector table is also called a dispatch table.
Interrupt Vector Table
Aug. 14, 2019
Get a detailed description of what interrupts are in actual and what is polling and their comparison.