INTERRUPTS Flashcards

1
Q

What is an interrupt?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of an interrupt?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is polling? And what does it involve?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an interrupt handler/ interrupt service routine?

A

special block of code associated with a specific interrupt condition OR a software routine that
hardware invokes in response to an interrupt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an interrupt I/O?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the importance of using interrupts?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the components of an interrupt capable device?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an interrupt vector?

A

the starting address of an interrupt service routine (ISR) or an Interrupt handler.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an Interrupt Vector Table

A

Interrupt vectors are stored in a table called interrupt vector table. Each item in the table indicates an address of the ISR.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain the function of an interrupt enable bit

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the function of an interrupt flag bit

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an RTI?

A

a special form of return instruction which restores the processor status, so that returns to the original program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the Basic Interrupt Sequence

A
  1. The device that requires service sets its flag bit when an event takes place.
  2. The microprocessor detects that a flag is set, verifies that the corresponding enable bit is also set, and triggers
  3. The processor status (A, B, X, Y, CC, and PC (return address)) is saved automatically on the stack.
  4. The microprocessor looks up the interrupt vector (the address of the ISR) for that device and puts the address into the PC.
  5. The microprocessor runs the ISR.
  6. At the end of the ISR, RTI must be used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Give two case scenarios where interrupts should be ignored

A
  1. 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.
  2. 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Give the different types and classifications of interrupts

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Draw an instruction cycle diagram with interrupts and discuss the instruction cycle process and the handling of interrupts

A

*See notes for pic

17
Q

Compare I/O based on polling with interrupt-driven I/O. In what situation would you favour one technique over the other?

A

K

18
Q

What are some of the drawbacks of using interrupts? Give possible solutions

A
  1. There are multiple I/O modules, how should the processor determine the device that issued the interrupt signal?
  2. How does the processor decide which module to process when multiple interrupts have occurred?

Multiple Interrupt Lines
we provide multiple interrupt lines between the processor and the I/O modules. This allows multiple modules to be handled at the same time.
Software Poll
Whenever an interrupt is detected by the processor, it branches to an interrupt service routine which will poll each and every I/O module to determine the exact interrupting module.

19
Q

in which situation is polling better than interrupts and vice versa

A

Some of the advantages of polling are the relatively simple program, transmission reliability that takes place at maximum speed, i.e. as soon as the I/O device is ready and the no need of additional access chips. Interruption is beneficial because it can serves multiple devices, it is more flexible and efficient.