OS

[OS] Basics of OS ( I/O Structure)

  • Storage is only one of many types of I/O devices within a computer

  • A large portion of operating system code is dedicated to managing I/O, both becasuse of its importance to the reliability and performance of a system and because of the varying nature of the devices

    Relibility and Performance of System greatly depends upon "How its input and output are managed in varying nature of the devices"

  • A gerneral-purpose computer system consists of CPUs and multiple device controllers that are connected through a common bus

  • Each device controller is in charge of a specific type of device

 

Device Controller

maintains

  • Local Buffer Storage
  • Set of Special Purpose Registers

 

Device Driver

  • Typically, operating systems have a devcie driver for each device controller

  • This device driver understands the device controller and presents a uniform interface to the device to the rest of the operating system

    → devices are very different that have a varying nature

  • To start an I/O operation, the device driver loads the appropriate registers within the device controller

    → Device controller maintains Set of registers, so these registers are requred for performing that particular input/output operation

  • The device controller, in turn, examines the contents of these registers to determine what action to take

  • The controller starts the transfer of data from the devcie to its local buffer

  • Once the transfer of data is complete, the device controller informs the device driver via an interrupt that it has finished its operation

  • The device driver then returns control to the operating system


❗This form of interrupt-driven I/O is fine for moving small amounts of data but can produce high overhead when used for bulk data movement


To solve this problem, Direct Memory Access (DMA) is used

 

DMA

  • After setting up buffers, pointers, and counters for the I/O device, the deivce controller transfers an entire block of data directly to or from its own buffer storage to memory, with no intervention by the CPU
  • Only one interrupt is generated per block, to tell the device driver that the operation has completed ( ↔ for being transfered via CPU is interrupt per byte of data so many times )
  • While the device controller is performing these operations, the CPU is available to accomplish other works

 

Youtube Neso Academy 강의를 듣고 정리한 글입니다.