Chapter 5 Input and Output (I/O) Management

5.1 Overview of I/O Management

5.1.1 I/O devices

1、人机交互类外部设备
2、存储设备
3、网络通信设备


一、按传输速率分类

1) Low-speed equipment 键盘、鼠标
2) Medium-speed equipment 打印机
3) High-speed equipment磁带机、光盘机

二、按信息交换的单位分类

1) Block device 以块为单位

2) Character device 以字符为基本单位


5.1.2 I/O control mode

Insert picture description here

一、程序直接控制方式

The program directly tests the equipment in a loop
Insert picture description here
Insert picture description here
Insert picture description here


二、中断驱动方式

  • Due to the program 直接控制方式CPU利用率低, busy, etc., an interrupt-driven method is proposed

Insert picture description here
Insert picture description here


三、DMA方式 The unit of data transmission is

是一种不经过CPU而直接从主存存取数据的数据交换模式,在I/O和主存之间建立一条数据通路,只是逻辑上的通路 Not physical access

Insert picture description here
Insert picture description here

  • When the CPU receives a DMA request from an I/O device, it sends a command to the I/O controller to start the DMA controller
  • DMA controller interacts directly with main memory
  • After the transfer is complete, the DMA controller sends an interrupt signal to the CPU

只有在传送开始和结束时才需要CPU的参与

Interrupt-driven DMA method
Interrupt when every data needs to be transferred The CPU is interrupted when the batch of data to be transmitted is all over

Insert picture description here


四、通道控制方式 [hardware]

  • Channel control method is to solve DMA方式连续存储的问题
    *Insert picture description here
    One channel can control multiple I/O controllers
    I/O控制器可以控制多个工人设备

Insert picture description here
Insert picture description here


5.1.3 Hierarchical structure of I/O subsystem

每一层利用下一层提供的服务

Insert picture description here
Insert picture description here
Insert picture description here


5.2 I/O core subsystem

5.2.1 Overview of I/O Subsystem

5.2.2 I/O scheduling concept

Disk scheduling is actually a kind of I/O scheduling

Insert picture description here

5.2.3 Cache and Buffer

1、磁盘高速缓存
2、缓冲区
Insert picture description here
Insert picture description here
1) Single buffer
Insert picture description here
Insert picture description here
2) Double buffer
Insert picture description here
3) Difference between single buffer and double buffer communication
Insert picture description here
4) Circular buffer

缓冲区为一个循环队列
Insert picture description here

5) Buffer pool

Insert picture description here
3、高速缓存与缓冲区对比
Insert picture description here


5.2.4 Allocation and recycling of equipment

Insert picture description here

1、设备分配概述
Insert picture description here
独占式设备:Only allow each process to use the device serially
共享式设备:Allow multiple processes to "use" the device at the same time(At the same time macroscopically, alternate microscopically)
2、设备分配的数据结构

The relationship between equipment, controller, channel

Insert picture description here

Device Control Table (DCT) 每个设备配置一张DCT,用于记录设备情况

Controller Control Table (COCT) 每个设备控制器对应一张COCT,根据COCT信息对控制器进行操作和管理

Channel Control Table (CHCT) 每个通道对应一张CHCT,对通道进行操作和管理

System Equipment Table (SDT) 整个系统只有一张SDT,记录已连接到系统中的所有物理设备的情况


3、设备分配的步骤

Insert picture description here


Insert picture description here


Insert picture description here


Insert picture description here


4、设备分配的安全性
Insert picture description here
死锁的避免:银行家算法


5.2.5 SPOOLing technology (spooling technology) 前提是多道程序

提高了I/O的速度;将独占设备变为共享设备;实现了虚拟设备的功能
When the key technology to improve the resource utilization of a single machine Multiprogramming

1. What is offline technology

Insert picture description here
Insert picture description here

2. Input well and output well Type-ahead

Insert picture description here

3. Input buffer and output buffer Well management program

Insert picture description here

4. Input process and output process Slow output program

Insert picture description here

Analysis of the Principle of Shared Printer—An Application of Spooling Technology

Insert picture description here
Insert picture description here
(1) Apply for the buffer zone first (在内存中), and send the printed data to the buffer zone.
(2) applying a blank for a user 打印请求表(存放打印信息的地址等信息)linked to a queue file
(3) the printer is idle, remove 打印请求表the data from the input shaft (磁盘中)passes 输出缓冲区(内存中), and then output to the printer.

  • After the print request is completed, the request form is deleted from the print queue, and subsequent print tasks are performed
    Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_38220799/article/details/109319723
Recommended