编程知识 cdmana.com

Operating system review notes Chapter 13 I / O input system

  • 13.1 summary
    • Device driver : The device driver is I/O The subsystem provides a unified device access interface , Just as system calls provide a unified standard interface between the application and the operating system .
  • 13.2 I/O Hardware
    • The communication between equipment and computer system can transmit information through cable or even air . The device communicates with the computer through a connection point ( Or port ), For example, the serial port . If one or more devices use a common set of wires , Then this connection is called a bus . Bus (bus) It's a set of lines and a set of strictly defined protocols that can describe the transmission of information over the wire .
    • attach :CPU Dealing directly with the controller . Device controller : Hardware , take CPU The command is converted into a signal , Send it to specific external devices
    • controller : For operation port , A group of electronic devices of a bus device .
    • I/O Ports usually have four registers , The status register , Control register , Data input register and data output register
      • The data input register is read by the host to obtain data .
      • The data output register is written by the host to send data .
      • The status register contains some host readable bits (bit). These bits indicate various states , for example , Whether the current task is completed , Whether there is data in the data input register that can be read , Whether there is equipment failure, etc .
      • The control register can be used by the host computer to send commands or change the state of the device .
    • 13.2.1 polling polling
      • Also known as busy waiting busy wait In circulation , Read the status register until the busy bit is cleared .
    • 13.2.2 interrupt
      • The basic interrupt mechanism works as follows .CPU The hardware has an interrupt request line (Interrupt-request line,IRL).CPU After each instruction is executed , Will be tested IRL. When CPU Detected that a controller has already sent a signal through the interrupt request line ,CPU An interrupt handler that will save the current state and jump to a fixed location in memory (interrupt-controller). Interrupt handler determines the cause of the interrupt , Do the necessary handling , Restore state , Finally, the interrupt returns (return from interrupt) Command to make CPU Returns the execution status before the interrupt , That is, the device controller sends a signal through the interrupt request line (raise) interrupt ,CPU a (catch) Interrupt and distribute (dispatch) In the interrupt handler , The interrupt handler clears by processing device requests (clear) interrupt .
    • 13.2.3 Direct memory access
      • For devices that need to be transported in large quantities , For example, disk drive , If you use an expensive general-purpose processor to look at the status bits and send data to the controller register by byte —— One is called program control I/O(Programmed/O,PlO) The process of , Then it's a waste . Many computers are trying to avoid using PIO increase CPU The burden of , Delegate part of the task to a dedicated processor , Called direct memory access (direct-memory access,DMA) controller .
  • 13.3 I/O Application interface
    • Clock and timer : Clock on the motherboard , Keep running
    • Timer timer The timer is reduced to 0, Send out a clock interrupt signal .
  • 13.4 I/O Kernel subsystem
    • I/O Dispatch Each device maintains a request queue for scheduling , The operating system provides a wait queue for device status .
    • buffer : A buffer is an area of memory used to hold data transferred between two devices or between devices and applications .
    • There are three reasons to use buffer :1 The speed difference between producers and consumers who process data streams .2 Coordinate devices that transmit data of different sizes 3. Support applications I/O Copy semantics . Ensure that the data to be written to the disk is the version of the system call ( Not changed )
    • A cache is a cache that can hold copies of data . Access to cache copies is more efficient than raw data access .
    • Spooling and device reservation : Spools are used to hold buffers set aside by the device , These devices ( Such as a printer ) Can't receive cross stream .
    • Error handling
    • I/O Protect : Mistakes are closely related to protection . By sending out illegal I/O Instructions , The user program can interrupt the normal operation of the system intentionally or unintentionally . Various mechanisms can be used to ensure that this interruption does not occur . To prevent users from executing illegal I/O, Define all I/O The instruction is a privileged instruction . therefore , Users cannot send it directly I/O Instructions , They have to be done through the operating system .
    • Kernel data structure object-oriented

Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .

版权声明
本文为[The struggling rabbit of florist]所创,转载请带上原文链接,感谢

Scroll to Top