Interrupts and Exceptions

Home > Computer Science > Computer Architecture > Interrupts and Exceptions

The events that interrupt the normal program execution, requiring the CPU to execute a special routine to handle the event.

Interrupts: A mechanism that temporarily stops the normal execution of the program and redirects it to a specific subroutine to perform a particular task before returning to the main program.
Exceptions: Events that occur during program execution, interrupting its usual flow and requiring specialized routines to handle them.
Vectoring: A technique used to associate interrupts with specific interrupt handling routines.
Interrupt Service Routine (ISR): A program that gets executed when an interrupt occurs, which calculates the task, and then returns control to the main program.
Interrupt Controller: A hardware device that manages the flow of interrupts in the system.
Polling: An alternate approach to interrupts in which the CPU continuously checks for input or output from a device instead of waiting for an interrupt.
Interrupt Latency: The time delay between the occurrence of an interrupt and the execution of the associated ISR.
Interrupt Priority: A mechanism that prioritizes multiple concurrent interrupts.
Interrupt Handlers: Programs that process deferred interrupts and exceptions after the system has stabilized.
Masking: A mechanism that temporarily disables interrupts to allow the current task to continue without interruption.
Nested Interrupts: A system configuration where an interrupt can further trigger another interrupt before returning control to the main program.
Exception Handling: Programs that are designed to manage exceptional events, including errors, power failures, and hardware malfunctions.
System Calls: Designed to request OS services, such as I/O or memory management, and typically executed using software interrupts.
Trap Instructions: CPU-specific instructions that force an exception to occur, for example, as a result of an illegal instruction execution.
Context Switching: The process of temporarily storing and restoring the state of a program to execute another program in a multitasking operating system.
Interrupt and Exception Handling using Assembly: Low-level programming techniques for creating efficient handling routines in Assembly Language.
Hardware Interrupts: These are generated by external devices, such as timers, keyboards, or disk drives, which require immediate attention from the CPU.
Software Interrupts: These are triggered by explicit software instructions, such as system calls or exceptions that require special handling by operating system kernel or user-mode programs.
Trap: A trap is a software-generated interrupt caused either by an exception condition or a specific instruction. It is used to switch the CPU from user mode to kernel mode to handle critical tasks.
Machine Check Exception: This is a type of hardware exception that is triggered when the computer detects an unrecoverable hardware error or failure, such as a faulty CPU, memory, or other components.
Page Fault Exception: This is raised by the CPU when it tries to access a memory location that is not currently available in the main memory. This may be due to the memory being swapped out or not yet allocated.
Divide-by-zero Exception: This occurs when the CPU executes a divide or modulo instruction with zero as the divisor.
Invalid Opcode Exception: This is raised when the CPU attempts to execute an instruction that is not defined or recognized by the processor's instruction set.
Privileged Instruction Exception: This is triggered when a user-mode program tries to execute a privileged instruction that requires kernel-mode access or higher-level permissions.
Stack Overflow Exception: This is raised when a program tries to push data onto the stack but the stack is already full.
Stack Underflow Exception: This is the opposite of a stack overflow exception, and occurs when the program tries to pop data off the stack but the stack is empty.
Floating-Point Exception: This is raised by the CPU when an arithmetic operation on floating-point numbers results in a NaN (Not a Number) or infinity value.
Breakpoint Exception: This is triggered by a software breakpoint instruction that is used for debugging and program development purposes.
Debug Exception: This is triggered by the CPU when a debug event occurs, such as a hardware breakpoint, a data watchpoint, or a single-step instruction.
Alignment Exception: This is raised when the CPU tries to access unaligned memory, i.e., data that is not properly aligned to a specific memory boundary.
Security Exception: This is triggered when an unauthorized access attempt is detected by the system's security mechanisms, such as running an untrusted application or accessing restricted files.
"In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to interrupt currently executing code (when permitted), so that the event can be processed in a timely manner."
"If the request is accepted, the processor will suspend its current activities, save its state, and execute a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event."
"The processor will... execute a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event."
"This interruption is often temporary, allowing the software to resume normal activities after the interrupt handler finishes." (Note: The paragraph does not specifically mention permanent interrupts, but it does mention that interrupts could indicate a fatal error, which could be interpreted as a permanent interruption.)
"Interrupts are commonly used by hardware devices to indicate electronic or physical state changes that require time-sensitive attention."
"Interrupts are also commonly used to implement computer multitasking, especially in real-time computing."
"Systems that use interrupts in these ways are said to be interrupt-driven."
"An interrupt (sometimes referred to as a trap)..."
"If the request is accepted, the processor will suspend its current activities, save its state..."
"The processor will execute a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event."
"This interruption is often temporary, allowing the software to resume normal activities after the interrupt handler finishes."
"Interrupts are commonly used by hardware devices to indicate electronic or physical state changes that require time-sensitive attention."
"Interrupts are also commonly used to implement computer multitasking, especially in real-time computing."
"Systems that use interrupts in these ways are said to be interrupt-driven."
"An interrupt (sometimes referred to as a trap) is a request for the processor to interrupt currently executing code."
"If the request is accepted, the processor will suspend its current activities, save its state..."
"The processor will execute a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event."
"Although the interrupt could instead indicate a fatal error."
"Interrupts are commonly used by hardware devices to indicate... state changes that require time-sensitive attention."
"Interrupts are also commonly used to implement computer multitasking, especially in real-time computing."