Lets open the Gate to the IITs.

Google Search

Tuesday, August 27, 2013

ARCHITECTURE: INTERRUPTS SOLVED

INTERRUPTS

  1. Hardware Interrupts.
  2.  Software Interrupts.
  3.   Exceptions.

HARDWARE INTERRUPTS

They are also called Asynchronous Interrupts, coz they can occur anytime without any knowledge beforehand.


       NMI 
            INTR 

NMI – It can’t be ignored by the system. It is used to handle situations that must be handled without any delay. Example –

Parity Error in Disk
Erroneous Bus Arbitration
Power Failure
Emergency Shut Off, etc

INTR – All I/O devices gain systems attention through this pin on Microprocessor. Example –


     Key Stroke on keyboard
     Mouse Click, etc


SOFTWARE INTERRUPTS

These are interrupts that are generated due to INT instructions mentioned in the program itself (this is why they are also called Synchronous Interrupts). Corresponding to an INT instruction there is an ISR (Interrupt Service Routine) to which the processor is redirected with the help of IVT (Interrupt Vector Table). The ISR in the end contains an IRET instruction which pops out the flag register values and then restores the previous execution sequence. This is where IRET differs from a simple RET, which does not involve popping of flag values, it just restores the previous execution sequence. Example of s/w interrupts –

INT 33H
INT 34H, etc

EXCEPTIONS

These are the interrupts that are caused internally in the processor itself. They are caused when a situation arises that can’t be handled by the processor alone.
They are similar to software interrupts in the way that they are just like INT instructions and redirect the control to an ISR through the IVT. But the difference is that they are known to the processor, in other words,  the number “n” of the “INT n” is given by the processor itself and not by the programmer as in case of INT instructions written by him in his program.
Different Types of Exceptions –

Faults
Traps
Aborts

Fault – It occurs before or during the execution of an instruction. The address of the instruction stored in the stack before jumping off to ISR (so as to rectify the fault) is the address of the instruction that was to be or was being executed, so that when the processor resumes, then it could re-execute the instruction after rectification is made by user through the ISR. Example

Page Fault.

Trap – It occurs after the execution of an instruction, when something unexpected happens that requires the user to handle the exception. Example

Divide by Zero
Overflow
Single Step Execution or Trace (together with the TRAP Flag)
Breakpoint
Bounds Exception
Invalid Op-code


Abort – It usually occurs due to very serious failures, such as hardware failures or invalid system tables. Because of this, it may happen that the address of the error cannot be found. Therefore, recovering program execution after an abort is not always possible, thereby leaving the only option of terminating or aborting the program that caused such exception. 

No comments:

Post a Comment

Popular Posts