Saturday, December 1, 2012

Interrupts


Introduction:

Interrupt can stop job and start another more important job, and every part of information below support you to understand how interrupts work.

What is an interrupt?

Definition : an event external to the currently executing process that causes a change in the normal flow of instruction execution. Usually generated by hardware devices external to the CPU.


Why Interrupts?

 People like connecting devices .

  •  A computer is much more than the CPU 
  • Keyboard, mouse, screen, disk drives
  • Scanner, printer, sound card, camera, etc.

 These devices occasionally need CPU service

  • But we can’t predict when.
 External events typically occur on a macroscopic
 timescale .
  • we want to keep the CPU busy between events


Alternative: Interrupts


Give each device a wire (interrupt line) that it can use to signal the processor 
  • When interrupt signaled, processor executes a routine called an interrupt handler to deal with the interrupt.
  • No overhead when no requests pending.





    Intel 430HX Motherboard :

    Programmable interrupt controller (PIC) part of the “South-bridge” chip :

    • Commonly 8259A chip
    •   8 inputs, 1 output
    •   Can be chained together
    • Newer systems use “Advanced PIC” (APIC) for SMP support Principle is the same



    Hardware Interrupt Handling :

     1- Details are architecture dependent!


    • Interrupt controller signals CPU that interrupt has occurred, passes interrupt number.
    • Interrupts are assigned priorities to handle simultaneous interrupts.
    • Lower priority interrupts may be disabled during service.

      2- CPU senses (checks) interrupt request line after every instruction; if raised, then:
       
      • Uses interrupt number to determine which handler to start.
      • Interrupt vector associates handlers with interrupts.


        3 - Basic program state saved (as for system call) .

        4 - CPU jumps to interrupt handler .

        5-  When interrupt done, program state reloaded and
        program resumes .

        Software Interrupt Handling :

        Typically two parts to interrupt handling
        • The part that has to be done immediately
        • So that device can continue working
        • The part that should be deferred for later
        • So that we can respond to the device faster
        • So that we have a more convenient execution context

        This link is help you to more understanding about interrupt of operating system.




          Now in your comments box down the code you must write five sentences about what did yuo learned With writing yourname and academic number









            No comments:

            Post a Comment