Operating System Principles Chapter 13 I/O System

Operating System Principles for Undergraduate Students Learning Record
Learning Record Family Bucket

13.1 Basic I/O Concepts

13.1.1 Basic overview of the I/O system

The core of the I/O system is: I/O control and management

The computer has 2 main tasks:

  • I/O operations - more frequent
  • calculate

I/O device features:

  • Wide variety, with new devices appearing constantly
  • Interface standardization: such as USB

13.1.2 Basic functions of the I/O system

  1. Hide the details of the physical device
  2. Device independent
  3. Improve utilization of processors and I/O devices
  4. Control I/O devices
  5. Ensure proper sharing of devices
  6. error handling

Device independence:

In order to improve the adaptability and scalability of the operating system

  • Device independence , also known as device independence, is achieved in modern operating systems

  • Applications are independent of the specific physical device used

Implementation

  • Introducing logical and physical devices

  • Use the logical device name in the application to request the use of a certain type of device

  • The system uses the physical device name during actual execution

  • The system must have the ability to convert logical device names to physical device names

I/O application interface

  • I/O system calls encapsulate device behavior into some generic types
  • The device driver layer hides various details of the I/O controller from the kernel
  • Devices vary widely in many ways

13.1.3 I/O Hardware Control

Control device method (by device address):

  • Direct I/O instruction: IN AL, 60H
  • Memory-mapped I/O: device address and memory address are addressed at the same time

I/O registers:

  • status register
  • control register

13.1.4 Types of I/O Devices

Classified by use characteristics:

  • storage device, I/O device

Classified by transfer rate

  • Low-speed devices: keyboard, mouse, voice input
  • Medium-speed devices: line matrix printers, laser printers
  • High-speed devices: tape drives, magnetic disks, optical disks

Classification by units of information exchange

  • block device, character device

Classified by the shared attributes of the device

  • Shared equipment, exclusive equipment

13.2 Control methods of I/O devices

I/O programmable method using polling: basically not used now

Programmable I/O mode using interrupts: CPU and I/O devices can work in parallel

Direct memory access DMA mode: further improves the degree of parallel operation of CPU and I/O devices

I/O channel control method

Main frequency: 3.0GHz

interrupt mechanism

There is an interrupt request line IRL on the CPU hardware

Basic Interrupt Working Mechanism

  • After the CPU executes each instruction, check the IRL
  • If a signal is detected, the CPU saves the current state and jumps to the interrupt handler
  • execute interrupt handler
  • After execution, clear the interrupt and return

interrupt handler

① Detect whether there is an unresponsive interrupt signal

② Protect the CPU environment of the interrupted process

③ Transfer to the corresponding equipment processing program

④ Interrupt processing

⑤ Restore the scene of the CPU and exit the interrupt

DMA direct memory access

In order to avoid using program-controlled I/O to transfer large amounts of data, you need

  • DMA controller

  • Transfer data directly between I/O devices and memory, bypassing the CPU

13.3 I/O Kernel Subsystem

Provides I/O-related services, builds on hardware and device driver structures, and is also responsible for protecting itself from erroneous processes and malicious users

13.3.1 I/O Scheduling

Some I/O requests are sorted according to the device queue

So there is a use similar to the first come first serve algorithm.

13.3.2 Buffering

In modern operating systems, there are buffers between the CPU and I/O devices exchanging data

A buffer is a storage area that can be composed of specialized hardware; more of a memory

Reasons for introducing buffering:

  • Alleviate speed differences between I/O devices and high-speed devices
  • Coordinated Data Transfer Data Size Inconsistency
  • Maintain "copy semantics"

Reasons for introducing buffering between the CPU and I/O devices:

  • Alleviate speed mismatch between CPU and I/O devices
  • Reduce the interrupt frequency of the CPU and relax the limitation of interrupt response time
  • Increased parallelism between CPU and I/O devices

13.3.3 Caches

cache - high-speed memory that keeps copies of data

  • just a copy
  • The key is performance

Differences from buffering:

  • The buffer may be the only copy of the data
  • A cache is a copy of data elsewhere on a high-speed storage device

13.3.4 Spooling SPOOLing

In order to alleviate the contradiction between the high speed of CPU and the low speed of I/O equipment, the off-line input and off-line output technology is introduced.

  • The program simulates offline input and transfers data from a low-speed I/O device to a high-speed disk

  • Another program simulates offline output, transferring data from disk to a slow output device

At this time, the peripheral operation and the processing of data by the CPU are carried out at the same time. This simultaneous peripheral operation realized in the online situation is called spooling technology SPOOLing

Components of the SPOOLing system

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-kcctnfsD-1641542739783) (E:\Documents and PPT\Junior Course Study\Operating System\Pictures\Tenth Chapter Three\SPOOLing System Composition.png)]

Features of the SPOOLing system

  • Increased speed of I/O devices
  • Change an exclusive device to a shared device
  • Realized the function of the virtual device

Guess you like

Origin blog.csdn.net/weixin_45788387/article/details/122366724