What are the difference between the trap and interrupt? What is the use of each function?

An interrupt is generally initiated by an I/O device, and causes the CPU to stop what its doing, save its context, jump to the appropriate interrupt service routine, complete it, restore the context, and continue execution. For example, a serial device may assert the interrupt line and then place an interrupt vector number on the data bus. The CPU uses this to get the serial device interrupt service routine, which it then executes as above. 


Feel free to contact the admin for any suggestions and help.