5. How do interrupts work?

Each interrupt has a corresponding 'interrupt service routine' (ISR). The interrupt service routine is a set of instructions that have to be carried out when the event occurs.

For example, a typical algorithm for handling the mouse might be:

  • Mouse moves
  • A hardware chip on the Motherboard, called the 'interrupt controller', detects the mouse signal
  • The interrupt controller issues an interrupt signal and sends it to the CPU
  • The CPU receives the interrupt signal
  • An exact copy of all of the registers in the CPU at that moment in time are stored in 'the stack' in primary memory so that the CPU can return to this exact state once it has finished dealing with the interrupt.
  • The CPU then starts executing the mouse interrupt service routine
  • Step 1 - CPU tells the graphics card to re-paint the screen cursor to correspond with the new mouse position.
  • Step 2 - CPU responds to any mouse clicks buttons if pressed
  • Interrupt service routine completes
  • CPU re-loads its registers with the original values it stored earlier and carries on with what it was doing.

An algorithm is a set of steps needed to complete a task.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Mouse Interrupt

 

 

Copyright © www.teach-ict.com