Docsity

Lecture Notes on Exceptions and Interrupts | CSC 246, Study notes of Computer Science

Partial preview of the text

Download Lecture Notes on Exceptions and Interrupts | CSC 246 and more Study notes Computer Science in PDF only on Docsity!

Exceptions and InterruptsExceptions and Interrupts

(continued)(continued)

November 17November 17

CSC201 Section 002

Fall, 2000

Device Priorities Device Priorities

  • Some devices are
    • More important than others
    • Or, need attention more quickly
  • Low-priority interrupts should not be able to interrupt ISRs for high- priority interrupts
  • The Pentium only has one interrupt request line; how indicate priority? - The Interrupt Controller does this for the CPU

How Priorities Can Be How Priorities Can Be

AccomplishedAccomplished

    1. Can disable interrupts for any specific device
    1. There are 16 interrupt request lines (signals)
      • IRQ0 priority > IRQ1 priority > ....
    1. Can disable interrupts on any individual interrupt request line

Example Interrupt Process Example Interrupt Process

  1. A program is executing
  2. The user presses a key on the keyboard
  3. The keyboard generates an interrupt request signal to the Interrupt Controller, using IRQ
  4. The Interrupt Controller generates an interrupt request to the processor, and waits for an acknowledgment
  5. When the CPU finishes the current instruction and fetches the next one, it checks whether there is any interrupt pending
  6. The CPU
    • acknowledges the interrupt
    • saves task state
    • clears (disables) the interrupt flag

Memory Privilege Levels Memory Privilege Levels

  • The Pentium has 4 memory privilege levels: 0 (highest) to 3(lowest) - The operating system runs at level 0, application processes at level 3 - Other levels for device drivers etc.
  • "Privileged memory" = areas that should not be read or written directly by user programs
  • Sections (segments) of memory are protected by privilege level - A memory reference (read or write) first compares the required privilege level at the address to the process's privilege level - If the process's priority isn't high enough, an exception is generated

Instruction Privilege Levels Instruction Privilege Levels

  • Instructions are also protected by privilege level
  • Some instructions are designed to specifically modify operating system data structures - Should not be executed by user processes; could overwrite the operating system!
  • When an instruction is fetched, the required privilege level is compared to the process's privilege level - If not high enough, an exception is generated