Computer-System Operation

Computer-System Operation

  • I/O devices and the CPU can operate concurrently.
  • Each device controller is in charge of a particular device type.
  • Each device controller has a local buffer.
  • CPU moves data from/to main memory to/from the local buffers.
  • I/O is from the device to local buffer of controller.
  • Device controller informs CPU that it has finished its operation by causing an interrupt.

Interrupts

Types

  1. Hardware - Asynchronous
    Device informs CPU that something has happened e.g. a key has been pressed on the keyboard.
  2. Hardware - Synchronous
    CPU has tried to do something that has caused the interrupt. e.g. tried to read from an invalid memory location. (not always a problem, it may mean that that page is on disk needs to be fetched). Often called an Exception or Trap.
  3. Software
    CPU asked for the interrupt to happen. e.g. to perform an OS Call. Often called a Trap.

Hardware Interrupts

  • I/O devices use Asynchronous Hardware Interrupts (i.e. caused by outside world and may happen at any time).
  • Transfers control to the interrupt service routine, through the interrupt vector, which contains the addresses of all the service routines.
  • CPU must save the address of the interrupted instruction.

Interrupt Handling

  • Interrupt handling is a very important part of the OS.
  • The operating system must preserve the state of the CPU by storing all registers.
  • Determine which type of interrupt has occurred:
    • polling - ask each device if it caused the interrupt.
    • vectored interrupt system - device identifies itself when it causes the interrupt.
  • Separate segments of code determine what action should be taken for each type of interrupt.