Last modified on April 19th, 2020
Exceptions And Interrupts in operating systems
Interrupts and exceptions are the events that can stop the normal operation of CPU for a temporary/permanent period.
What is Interrupt?
Interrupts are events that are generated by hardware or software and these events stop the normal operation of CPU for a temporary period.
There are two types of interrupts;
Synchronous interrupts. For example, software interrupts, commonly called exceptions.
Asynchronous interrupts. For example, hardware interrupts.
What are types of interrupts?
What are maskable interrupts?
Maskable interrupts are those interrupts that can be denied by CPU.
Maskable interrupts can be disabled by the programmer. When interrupts are disabled by the programmer then interrupts are not handled, it does not matter that interrupts have priority high or having no priority.
What are examples of maskable interrupts?
I/O device interrupts can’t be delayed.
What are nonmaskable interrupts?
Nonmaskable interrupts are interrupts that can’t be denied by CPU due to their more priority.
Examples of nonmaskable interrupts
Critical hardware failure can’t be denied
System resets can’t be denied.
What are examples of Non-maskable interrupts?
- Software interrupts can’t be delayed or denied.
- Critical hardware failure can’t be denied.
- System resets can’t be denied
What are exceptions?
Synchronous interrupts are called exceptions. Instruction faults are referred as exceptions.
Example of exceptions
Division by zero is an example of an exception.
What are asynchronous exceptions?
asynchronous exceptions can occur accidentally at any place.
What are examples of asynchronous exceptions?
- I.O request
- Hardware malfunction
- Power failure
What are synchronous exceptions?
Software interrupts are referred as synchronous exceptions.
Synchronous exceptions always occur when event reached to a certain statement in the source code.
Examples of synchronous exceptions
- Tracing the instruction execution
- arithmetic overflow
- page fault etc
Division of synchronous exceptions:
What are faults?
Faults are unintentional and mostly recoverable.
page faults recoverable
Protection fault not recoverable
Faults are detected and serviced by the processor before the faulting instructions.
What are traps?
Traps are caused by an exceptional condition.
e.g Invalid memory accesses, division by zero and breakpoints.
Traps are intentional.
Results in switching from user mode to kernel mode.
Traps are serviced after the instruction causing the trap. User-defined interrupts go into this category and can be said to be trapped.
A trap is a kind of exceptions, whose main purpose is for debugging (eg. notify the debugger that an instruction has been reached).
What are aborts?
Aborts occur when severe system problems occur, and recovery is not possible.
e.g parity error and hardware error.
- List of Public service commissions - August 31, 2020
- Comparison of fee structure of Pakistani Universities - June 1, 2020
- Past Guess Paper of Auditing - May 12, 2020