lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Interrupts.html (2849B)


      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3 <html><head><link rel="stylesheet" href="sitewide.css" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content="Evernote Mac 6.13.1 (455785)"/><meta name="altitude" content="0.01143651083111763"/><meta name="author" content="Alex Balgavy"/><meta name="created" content="2017-12-17 12:46:30 PM +0000"/><meta name="latitude" content="52.37355020663739"/><meta name="longitude" content="4.83620649643994"/><meta name="source" content="desktop.mac"/><meta name="updated" content="2017-12-17 1:33:02 PM +0000"/><title>Interrupts</title></head><body><div>if the program was just waiting for a signal from an I/O device it would be an insane waste of time. that’s why they invented interrupts.</div><div>interrupt request — hardware signal sent by I/O device</div><div>after a processor receives this signal, it responds through an interrupt-service routine</div><div>after interrupt-service routine is done, an interrupt acknowledge signal is sent to the device</div><div>interrupts can be enabled/disabled by setting the IE bit of the status register PS</div><div><br/></div><div>btw, also used in exceptions and debugging!</div><div><br/></div><div>Example execution:</div><div><ol><li>Device raises an interrupt request, interrupt request arrives during execution of instruction <i>i</i></li><li>Processor completes execution of instruction <i>i</i></li><li>Saves contents of PC (counter) and PS (status)</li><li>Interrupts are disabled by setting IE bit of PS to 0</li><li>Processor loads PC with address of first instruction of interrupt-service routine, routine is executed</li><li>After execution, PC and PS are restored (including setting IE bit to 1)</li><li>Processor continues from instruction <i>i</i>+1</li></ol><div><br/></div></div><div><img src="Interrupts.resources/screenshot.png" height="425" width="816"/></div><div><br/></div><div><b>Multiple devices</b></div><div>organised in a priority structure</div><div>priority level of processor is priority of program that is being executed</div><div>only interrupts from higher priorities than the processor's are accepted</div><div><b><br/></b></div><div>option 1 — polling</div><div><ul><li>poll all devices</li><li>the first to set the IRQ bit of PS to 1 is serviced<br/></li></ul></div><div><br/></div><div>option 2 — vectored interrupts</div><div><ul><li>allocate area in memory to hold addresses of interrupt-service routines (interrupt vectors)</li><li>each device identifies itself on request</li><li>the info provided by requesting device is a pointer into the interrupt-vector table</li></ul><div><br/></div></div><div><br/></div><div><br/></div></body></html>