Question

In: Computer Science

Explain how the interrupt mechanism works in Unix? Use a clear and concise diagram.

Explain how the interrupt mechanism works in Unix? Use a clear and concise diagram.

Solutions

Expert Solution

Interrupt :-

The interrupt is an event that changes the instructions sequence executed by the processor.

There are two types of interrupts:

Synchronous interrupt (Exception) the interrupt produced by the CPU while processing instructions is known as Exception

Asynchronous interrupt (Interrupt) the interrupt issued by other hardware devices

Exceptions are created by programming errors like Divide error, Page Fault, Overflow etc that must be handled by the kernel. He sends a signal to the program and tries to recover from the error.

Interrupts can be issued by input output devices such as keyboard, network adapter,etc When an interrupt occures, the CPU stop his current instruction and execute the newly arrived interrupt.CPU also need to save the old interrupted process state to resume it after the interrupt is handled.

There are two different interrupt levels are defined:

Maskable interrupts:- Interrupts issued by I/O devices; can be in two states, masked or unmasked. Only unmasked interrupts are getting processed.

Nonmaskable interrupts:- Interrupts critical malfunctions such as hardware failure ,etc are always processed by the CPU.

Every hardware device in the computer has it's own Interrupt Request (IRQ) line. The IRQs are numbered starting from 0. All IRQ lines are connected to a Programmable Interrupt Controller (PIC). The PIC listens on IRQs and assigns them to the CPU. It is also possible to disable a specific IRQ line through program.
Modern multiprocessing Linux systems generally include the newer Advanced PIC (APIC), which distributes IRQ requests equally between the CPUs.

The mid-step between an interrupt or exception and the handling of it is the Interrupt Descriptor Table (IDT). This table associates each interrupt or exception vector (a number) with a specified handler for example Divide error gets handled by the function divide_error()

Through the IDT, the kernel knows exactly how to handle the occurred interrupt or exception.

The Step that Kernal follows when receive the interrupt

  • The CPU checks after each instruction if there's a IRQ from the (A)PIC
  • If so, consults the IDT to map the received vector to a function
  • Checks if the interrupt was issued by a authorized source
  • Saves the registers of the interrupted process
  • Call the according function to handle the interrupt
  • Load the recently saved registers of the interrupted process and try to resume it

Flow :-


Related Solutions

Diagram and explain how a Van de Graff works. Be clear.
Diagram and explain how a Van de Graff works. Be clear.
Explain the main purpose of an interrupt signal. Give an example of how the interrupt is...
Explain the main purpose of an interrupt signal. Give an example of how the interrupt is used.
With the aid of a diagram, explain how “one way mirror works” and how can be...
With the aid of a diagram, explain how “one way mirror works” and how can be improved.  
1. What is the mechanism of interrupts? 2. How does an interrupt occur? 3. How should...
1. What is the mechanism of interrupts? 2. How does an interrupt occur? 3. How should two or more simulations interrupt requests be handled?
Draw a diagram of a MEMS capacitive sensor for pressure and explain how it works. Answer...
Draw a diagram of a MEMS capacitive sensor for pressure and explain how it works. Answer following questions: 1. How does the capacitance of a parallel-plate capacitor depend on area and separation? 2. How does the sensitivity of a capacitive sensor depend on its dimensions and temperature? 3. A MEMS parallel-plate capacitor has a capacitance of 1 pF. If the separation between the plates decreases by 10% what will be its capacitance?
Explain What Multi-protocol label Switching and how it works using diagram?
Explain What Multi-protocol label Switching and how it works using diagram?
Explain, with a few sentences, how RNAi works as a defense mechanism against viruses and what...
Explain, with a few sentences, how RNAi works as a defense mechanism against viruses and what is Cross-kingdom RNAi.
explain the use of fork, exec, and wait functions in unix
explain the use of fork, exec, and wait functions in unix
With the use of clear examples, explain how microeconomics is used in macroeconomics.
With the use of clear examples, explain how microeconomics is used in macroeconomics.
Explain how the G1 Checkpoint in response to DNA damage works. Draw a diagram that indicates...
Explain how the G1 Checkpoint in response to DNA damage works. Draw a diagram that indicates the proteins involved in this checkpoint and explain their roles in this process. Be sure to include all steps from the DNA damage to the arrest of the cell cycle.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT