1. Define the concepts interrupt and trap, and explain the purpose of an interrupt vector.
Interrupt is a signal generated from hardware/software to a processor indicating that an event needs to happen immediately. The CPU stops all the activities and transfers the control to Interrupt Handler/Interrupt Service Routine (ISR), which executes and returns the control back to CPU. The CPU then resumes the normal activities.
Interrupt Vector contains a memory location of interrupt service routine(ISR). Generally, they are in the form of a table stored in low memory location. Interrupt vectors are prioritized and queued in this table. When CPU is Interrupted, its looks for an ISR in interrupt vector table and transfers the control to it.
Trap/exception is a software generated interrupt caused either by an error (for example, division by zero) or a specific request from a user program that an operating system service needs to be performed. More simply, trap can be defined as automatically occurring software interrupts.