This study guide covers the distinctions between CPU external interrupts and internal exceptions. Understanding these differences is crucial for comprehending how a CPU handles various events that deviate from normal program execution.
Sources and Timing of Interrupts and Exceptions
The fundamental difference lies in their origin and their relationship with the currently executing instruction.
External Interrupts
- Source: Originate from CPU external hardware components.
- Timing: They are asynchronous, meaning they are unrelated to the current instruction being executed.
- Detection: Typically detected by the CPU after a single instruction execution is completed.
- Examples: Signals from the system clock (for time-based events) or I/O devices such as keyboards, network cards, or disk drives signaling that they have data ready or require attention.
Internal Exceptions
- Source: Originate from CPU internal logic or errors during instruction processing.
- Timing: They are synchronous with the instruction that caused them.
- Detection: Detected during instruction execution.
- Examples:
- Illegal operations: Attempting to perform an undefined instruction or an operation like division by zero.
- Address out-of-bounds errors: Trying to access memory outside the allocated space.
- Page faults: Occur when a program attempts to access memory that is not currently loaded into RAM, managed by the Memory Management Unit (MMU).
- System calls: Explicit requests made by a program to the operating system for a service.
Key Differences Summarized
| Feature | External Interrupt | Internal Exception |
|---|---|---|
| Origin | External to the CPU | Internal to the CPU |
| Synchronicity | Asynchronous (unrelated to current instruction) | Synchronous (caused by current instruction) |
| Detection | After instruction completion | During instruction execution |
Key Takeaways
- External interrupts are signals from outside the CPU, occurring independently of the current instruction.
- Internal exceptions are generated by the CPU itself due to errors or specific events during the execution of an instruction.
- The synchronous nature of internal exceptions means they are directly tied to the instruction that triggered them, while asynchronous external interrupts can happen at any time.
- Understanding these distinctions helps in diagnosing and managing how a computer system responds to both routine events (like clock ticks) and unexpected issues (like illegal operations or page faults).