A trap is nothing but an exception that is caused by an abnormal condition. It is also used to invoke a system call or kernel routine because this has a higher priority than the user’s code. An interrupt is a response generated by the hardware which will occur at random times during the execution of the program. However, we cannot devise a substitute for traps using interrupts and exceptions because of the following reasons:
1. The interrupts are asynchronous whereas the exceptions and the traps are said to be synchronous.
2. The traps and exceptions can be manipulated or called whenever required whereas interrupts occur mostly at unwanted and random times.
To stop a process from happening, Ctrl + C is also done which is a user-defined interrupt in DOS operating systems