Fifth chapter I/O management
- I/O control mode: Program direct control mode, interrupt drive mode, DMA mode, channel control mode.
- Direct control of the program: the CPU needs to be external to the loop check until it is determined that the word is already in the IO Controller data register. CPU and IO devices can only be serialized.
- Interrupt Drive mode: Allows the IO device to actively interrupt the CPU to run and request services, freeing the CPU so that the CPU can continue to do other work after sending the read command to the IO controller. In Word transmission, each word needs to be interrupted.
- DMA mode: In the IO device and memory to open a direct data path, completely free the CPU, data block transmission, only at the beginning or end of the need for CPU intervention, the entire data transmission is under the control of the DMA controller to complete.
- The DMA controller should be set up to include a class four register: the command/Status register (CR) accepts IO commands from the CPU or the state of the control information or device, and the memory address register (MAR) input is the memory source address that holds the initial destination address/output of the memory. Data register (DR) memory-to-device or device-to-memory data, Data counter (DC) holds the number of words in this transfer
- DMA Mode work process: When the CPU receives the DMA request to the IO device, it sends a command to the DMA controller, initiates the DMA controller, controls the operation data by the DMA, the CPU goes to do other things, the DMA controller interacts with the memory, transmits the whole data block, passes one word at a time, This process does not require CPU involvement, and when all transfers are complete, the DMA controller sends an interrupt signal to the CPU.
- Channel control mode: IO Channel is specifically responsible for the input and output processor. A set of data blocks read and write units, the implementation of CPU, channel, and IO devices are three parallel.
- Channel control mode work process: The CPU receives an IO device request, an IO instruction is given to the channel, gives the first address of the executing channel program and the IO device to be accessed, and the channel Execution channel program completes the CPU-specific IO task, and sends an interrupt request to the CPU after the data transfer is finished.
- IO channel and the difference between the general processor: the channel instruction is single, without its own memory, the channel program is stored in the host memory and CPU shared memory.
- IO Channel and DMA mode difference: The DMA mode requires the CPU to control the size of the transmitted data block, the transmitted memory location, each DMA controller corresponds to a device and memory transfer data, channel control transmission information, can control multiple devices and memory data exchange.
- Level of IO subsystem: User layer IO software, device independence software, device driver, interrupt handler, hardware Device
- I/O scheduling is to determine a good order to execute these I/O requests.
- Disk cache uses memory space to stage information from a series of disk blocks that are read out of the disks.
- The disk cache is logically part of the disk, and physically it is a disk block that resides in memory.
- The cache is divided into two forms in memory: one is to create a separate storage space in memory as a disk cache, a fixed size, and an unused memory space as a buffer pool for paging system and disk I/O sharing.
- In the device management subsystem, the main purpose of introducing buffers is:
1) Mitigate the contradiction between the speed mismatch between the CPU and the I/O devices.
2) Reduce the frequency of interrupts to the CPU and relax the CPU interrupt response time limit.
3) solve the problem that the basic data unit size (that is, data granularity) does not match.
4) Increase parallelism between the CPU and the I/O devices.
- Buffering techniques are: a single buffer (set a buffer between the device and the processor) double buffering (buffer 1 full reload 2, processing is full then processing 2) loop buffer (multiple equal size buffers, each buffer has a link pointer to the next buffer, the last point to the first) buffer pool (System public buffer, Buffer divided into three queues)
The difference between cache and buffer
- Device allocation refers to the devices that are required to be allocated based on the user's I/O requests. The general principle of allocation is to give full play to the efficiency of the use of equipment, as far as possible to keep the equipment busy, but also to avoid due to unreasonable allocation method caused by process deadlock.
- Device features, the following three ways of using the device are called exclusive devices, shared devices and virtual devices.
- Spooling technology was introduced in the era of batch operating systems, i.e., spool I/O technology. This technique is used to manipulate the device, essentially batching the I/O operations.
- Spooling technology is essentially a space-for-time technology, the request paging system in the page scheduling algorithm is just the opposite, is a time-changing space technology.
- Main data structure for device allocation: Device Control List (DCT), Controller control Table (COCT), Channel Control Table (CHCT), and System Equipment table (SDT)
- Device allocation data structures accessed successively: SDT-DCT-COCT-CHCT
- A Device control table characterizes a device, and the table entry in this control table is the individual properties of the device. Each device is divided into mechanical parts and electronic parts, which is responsible for the interpretation of the upper layer of the command and control the resolution of the component operation is the electronic components (Controller), so each DCT, need a table key to represent the controller, that is, a point to the Controller control Table (COCT), Therefore, the DCT has one by one correspondence with COCT.
System Equipment Table SDT: There is only one SDT for the entire system. It records the case of all physical devices connected to the system, with each physical device occupying a single table.
- Device Allocation considerations: intrinsic properties of I/O devices, allocation algorithms for I/O devices, security of I/O device allocations, and the independence of I/O devices.
- Equipment Allocation principle: Equipment allocation should be based on the characteristics of the device, user requirements and system configuration. The general principle of distribution: both the use of equipment to maximize the efficiency, but also to avoid causing deadlocks, and the user program and specific equipment to isolate.
- For an exclusive device, you can either use dynamic allocation or static allocation, often using static allocation method, that is, before the job execution, the job will be used to assign this type of equipment to it. Shared devices can be shared by multiple processes, generally using dynamic allocation, but only by one process per unit of time for each I/O transfer, usually with first-request allocation and priority-first allocation algorithm.
- Device independence is introduced in order to increase the flexibility of device allocation and the utilization of equipment and facilitate I/O redirection. Device independence means that the application is independent of the physical device that is used specifically. To implement device independence, use logical device names in your application to request a class of devices, and set up a logical device table (LUT) in the system to map logical device names to physical device names. The Lut table entry includes the logical device name, the physical device name, and the device driver entry address, when the process uses the logical device name to request the allocation of the device, the system assigns it the appropriate physical device, and establishes a table entry in the Lut, and later the process uses the logical device name to request I/O operations. The system looks for the appropriate physical device and driver by locating the LUT.
There are two ways to establish a logical device table in the system:
1) Only one lut is set up throughout the system. In this way, the device allocation of all processes is recorded in this table, it is not allowed to have the same logical device name, mainly for the single-user system.
2) set up a lut for each user. When the user logs in, the system establishes a process for the user, creates a lut for it, and puts the table in the process's PCB.
- The main features of the spooling system are: improved I/O Speed: Transforming an exclusive device into a shared device and implementing a virtual device function.
- The input and output well is the storage space on the disk, and the input and output buffers are opened in memory.
- The user prints the data first sent to the output well, the output well on the disk.
Operating system Fifth Chapter summary/