Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between interrupt and exception context?

Is there any major difference between the two? Is there anything that can be done in one and not the other? Do I need to take more care when modifying, for example, the page fault handler than a timer handler?

like image 274
alexgolec Avatar asked Sep 03 '11 21:09

alexgolec


People also ask

What is the difference of interrupt and exception in arm?

One way to distinguish between the two is that an exception is an event (other than branch or jump instructions) that causes the normal sequential execution of instructions to be modified. An interrupt is an exception that is not caused directly by program execution.

What is the main difference between a trap exception and an interrupt?

There are two kinds of events: traps and interrupts. The difference between a trap and an interrupt is that a trap is triggered by a user program to invoke OS functionality. Still, an interrupt is triggered by a hardware device to allow the processor to execute the corresponding interrupt handler routine.

What is the difference between ESR and ISR?

One other related difference between an ESR and an ISR is that an exception handler in many cases cannot prevent other exceptions from occurring, while an ISR can prevent interrupts of the same or lower priority from occurring.

What is the purpose of exceptions and interrupts?

Interrupts and exceptions are used to notify the CPU of events that needs immediate attention during program execution. Exceptions and interrupts are events that alters the normal sequence of instructions executed by a processor.


2 Answers

Interrupt is one of the classes of exception. There are four classes of exception: interrupt, trap, fault and abort. Interrupt occurs asynchronously and it is triggered by signal which is from I/O device that are external by processor. After exception handler finish handling this interrupt(exception processing), handler will always return to next instruction.

like image 90
Gyan Gupta Avatar answered Sep 19 '22 13:09

Gyan Gupta


Interrupts and exceptions both alter the program flow. The difference between the two is that interrupts are used to handle external events (serial ports, keyboard) and exceptions are used to handle instruction faults, (division by zero, undefined opcode).

Interrupts are handled by the processor after finishing the current instruction. If it finds a signal on its interrupt pin, it will look up the address of the interrupt handler in the interrupt table and pass that routine control. After returning from the interrupt handler routine, it will resume program execution at the instruction after the interrupted instruction.

Exceptions on the other hand are divided into three kinds. These are Faults, Traps and Aborts. Faults are detected and serviced by the processor before the faulting instructions. Traps are serviced after the instruction causing the trap. User defined interrupts go into this category and can be said to be traps; this includes the MS- DOS INT 21h software interrupt, for example. Aborts are used only to signal severe system problems, when operation is no longer possible.

Research at: https://www.allinterview.com/showanswers/14289/distinguish-between-interrupts-and-exceptions.html

like image 43
pega wega Avatar answered Sep 23 '22 13:09

pega wega