Docsity

Computer Achitecture and org - Priority Interrupts , Study notes of Computer Architecture and Organization

Partial preview of the text

Download Computer Achitecture and org - Priority Interrupts and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Priority Interrupts

Priority Interrupt - polling

  • (^) Establishes priority over the various sources to

determine which condition is to be serviced first

when two or more requests arrive

simultaneously.

  • (^) The system may also determine which

conditions are permitted to interrupt the

computer while another interrupt is being

serviced.

  • (^) Priority can be established can be done by

software or hardware

  • (^) Software – polling – common branch address for

all interrupts.

  • (^) Highest priority source is tested first and if its

interrupt signal is on, control branches to a

service routine for this source

Daisy chaining

• Hardware priority interrupts – serial or

parallel connection of interrupt lines.

• Serial – daisy chaining

One stage of daisy chain priority interrupt scheme

If PI = 0, both PO and the enable line to VAD

(vector address) are equal to 0, irrespective of

RF.

Parallel Priority Interrupt

• Uses a register whose bits are set separately

by the interrupt signal from each device.

• Priority is established according to the

position of the bits in the register.

• Mask register is used to disable lower priority

interrupts while a higher priority device is

being serviced.

• It can also provide a facility that allows a

high-priority device to interrupt the CPU

while a lower priority device is being serviced

  • (^) Mask register has a same number of bits as the interrupt register.
  • (^) By means of program instructions, it is possible to set or reset any bit in the mask register.

Priority encoder

Circuit that implements the priority function. Logic – if two or more inputs arrive at the same time, the input having the highest priority will take precedence. Boolean functions X = I’ 0 I’ 1 Y = I’ 0 I 1 + I’ 0 I’ 2 IST = I 0 + I 1 + I 2 + I 3

Interrupt

  • (^) An interrupt is a signal from a device attached to a computer or from a program within the computer that causes the CPU to stop its normal program execution and perform service related to the event.
  • (^) Examples of interrupts :I/O completion, divide-by-0, etc.
  • (^) Maskable Interrupt : It is a hardware interrupt that may be ignored by setting a bit in an interrupt mask register's (IMR) bit-mask.
  • (^) Nonmaskable Interrupt :is a hardware interrupt that does not have a bit-mask associated with it - meaning that it can never be ignored. NMIs are often used for timers, especially watchdog timers

Interrupt Service Routine An interrupt handler, also known as an interrupt service routine (ISR), is a callback subroutine in an operating system whose execution is triggered by the reception of an interrupt. Interrupt handlers have a multitude of functions, which vary based on the reason the interrupt was generated. Interrupt Overhead The interrupt overhead is caused by context switching (storing and restoring the state of CPU ) On interrupt handler entry, the context of the current process and its thread must be saved. On exit, it must be restored. On handler entry, memory locations different from the memory locations in the cache are used, and therefore cache updates are required. -In a similar way, the interrupted process suffers from the interrupt: -the cache it was using is disturbed, and cache updates are required

Reentrant code

  • (^) A computer program or routine is described as reentrant if the routine can be re-entered while it is already running (i.e it can be safely executed concurrently).
  • (^) To be reentrant, a computer program or routine:
    • (^) Must hold no static (or global) non-constant data.
    • (^) Must not return the address to static (or global) non-constant data.
    • (^) Must work only on the data provided to it by the caller.
    • (^) Must not modify its own code. (unless executing in its own unique thread storage)
    • (^) Must not call non-reentrant computer programs or routines.
  • (^) Example of non-reentrant code int g_var = 1; int f() { g_var = g_var + 2; return g_var; } int g() { return f() + 2; }

Interrupt nesting

• An interrupt can happen while executing

an ISR. This is called in terrupt nesting.

Bus Arbitration

  • (^) If several units can generate requests for bus access simultaneously, the bus master (bus controller) needs a way to select one of the units. This selection process is called Bus arbitration
  • (^) Three different arbitration schemes: (number of control lines, speed of bus controller) - (^) Daisy chaining - (^) Polling - (^) Independent requesting
  • (^) Some bus systems combine several distinct arbitration techniques
  • (^) Bus arbitration schemes usually try to balance two factors:
  • (^) – Bus priority: the highest priority device should be serviced
  • (^) first
  • (^) – Fairness: Even the lowest priority device should never
  • (^) be completely locked out from the bus.
  • (^) Types of Arbitration:
  • (^) static: (priority fixed) dynamic: (flexible priority)
  • (^) - Daisy chaining- polling
  • (^) - Parallel arbitration - Time slice
  • (^) - Independent Requesting. -LRU/FIFO
  • (^) - rotating daisy chain

polling

  • (^) Unit requests the bus via BUS request line.
  • (^) In response, the Bus controller proceeds to generate a sequence of numbers on the poll-count lines.
  • (^) Each unit compares to the unique address assigned to it.
  • (^) When requesting unit finds the match, Bus Busy signal is activated.
  • (^) In response, bus controller terminates the polling process and Ui connects to the bus.
  • (^) Advantage: failure of one unit need not affect the other units.
  • (^) Disadvantage: expensive because of more control lines. Number of units are limited based on the poll-count lines capability

Independent Requesting

  • (^) The bus controller determines priority, which is programmable.
  • (^) Drawback: 2n Bus request and bus grant lines to control n devices, whereas daisy chaining requires 2 such lines and polling requires log 2 n lines approximately. Bus Controller U 1 U 2 … Un Bus Bus Request Bus Busy Bus Request Bus Request n Bus Grant Bus Grant Bus Grant n