INTERRUPTS Flashcards
What is an interrupt?
Def 1: An event that requires the CPU to stop the current program execution and perform
some service related to the event.
Def 2: Interrupts are events that require a change in the control flow, other than jumps or
branches.
What is the purpose of an interrupt?
They appeared as an efficient way to manage I/O devices: instead of continuously checking the
state of a peripheral device (polling), the CPU does something else until it is announced by the
peripheral (with an interrupt) that it is ready; at this moment CPU suspends its regular
operation and take appropriate measures to handle the interrupt.
What is polling? And what does it involve?
Polling is the process where the computer or controlling device waits for an external device to check for its readiness or state, often with low-level hardware.
It involves:
Actively sampling the status of an external devices.
Keep checking the Port to see if the switch is being pressed.
What is an interrupt handler/ interrupt service routine?
special block of code associated with a specific interrupt condition OR a software routine that
hardware invokes in response to an interrupt.
What is an interrupt I/O?
a way of controlling input/output activity whereby a peripheral or terminal that needs to make or receive a data transfer sends a signal which causes the program interrupt to be set
What is the importance of using interrupts?
1.Coordinate I/O activities and prevent the CPU from being tied up during data transfer process.
• The CPU needs to know if the I/O is ready before it can proceed.
• Without the interrupt capability, the CPU needs to check the status of the I/O device continuously.
2.Perform time-critical applications/events.
• Many emergent events require the CPU to take action immediately.
• The interrupt mechanism provides a way to force the CPU to divert from normal program execution and take immediate actions.
What are the components of an interrupt capable device?
Cause:
• An event which necessitates the interrupt.
• Starting addresses at which the ISR for a particular device begins.
• When a device needs to be serviced (something happens in the device), a specific bit is set.
Configuration:
• Most devices have some options, such as time interval, effects on I/O, etc.
What is an interrupt vector?
the starting address of an interrupt service routine (ISR) or an Interrupt handler.
What is an Interrupt Vector Table
Interrupt vectors are stored in a table called interrupt vector table. Each item in the table indicates an address of the ISR.
Explain the function of an interrupt enable bit
Usually, only a subset of the available hardware devices is needed. The microprocessor does not need to pay attention all hardware devices. The microprocessor can selectively enable a device’s request Each individual hardware device has an enable bit in the microcontroller. If the microprocessor wants to handle the device’s request, the enable bit should be set to 1.
The enable bit is set to 0, if the microprocessor should ignore the device’s interrupt request.
*See notes for pic
Explain the function of an interrupt flag bit
A device sets a specific bit in memory to get the attention of the microprocessor, when it needs to be serviced (meaning something happens in the device). The device will set its flag to 1 when it believes that it needs to be serviced. Eg
A push button is being pressed. Then, the interrupt flag bit of the push button will be set to 1.
The microprocessor can read the status of buttons using interrupts.
*See notes for pic
What is an RTI?
a special form of return instruction which restores the processor status, so that returns to the original program.
What is the Basic Interrupt Sequence
- The device that requires service sets its flag bit when an event takes place.
- The microprocessor detects that a flag is set, verifies that the corresponding enable bit is also set, and triggers
- The processor status (A, B, X, Y, CC, and PC (return address)) is saved automatically on the stack.
- The microprocessor looks up the interrupt vector (the address of the ISR) for that device and puts the address into the PC.
- The microprocessor runs the ISR.
- At the end of the ISR, RTI must be used.
Give two case scenarios where interrupts should be ignored
- During the middle of an instruction
• Since the microprocessor may take several clock cycles to load an instruction, an interrupt could disrupt the fetching of an operation. - Interrupt another device
• A device should never be able to interrupt another device. This could prevent another ISR from finishing a reasonable amount of time.
Give the different types and classifications of interrupts
1.Hardware and Software Interrupts –
When microprocessors receive interrupt signals through pins (hardware) of microprocessor, they are known as Hardware Interrupts. Software Interrupts are those which are inserted in between the program which means these are mnemonics of microprocessor.
2.Vectored and Non-Vectored Interrupts –
Vectored Interrupts are those which have fixed vector address (starting address of sub-routine) and after executing these, program control is transferred to that address. Non-Vectored Interrupts are those in which vector address is not predefined. The interrupting device gives the address of sub-routine for these interrupts.
3.Maskable and Non-Maskable Interrupts –
Maskable Interrupts are those which can be disabled or ignored by the microprocessor. Non-Maskable Interrupts are those which cannot be disabled or ignored by microprocessor.