Device management in computer operating systems

Source: Internet
Author: User
ArticleDirectory
    • Program Io Mode
    • Interrupt driver I/O Control Mode
    • Direct Memory Access DMA Io Control Mode
    • Io channel control mode
    • Benefits of device independence
    • Device Independent Software
    • How to map logical device names to physical device names
    • Composition of the spooling System
    • Features of the spooling System
    • Service FCFS first
    • The shortest time is preferred.
    • Scan Algorithm
    • Cyclic scanning algorithm
    • Parallel cross-Access
    • Raid advantages:
Io Control Mode

Throughout the development of the IO control mode, the objective is always to minimize the host's Io control intervention and free the host from complicated Io control transactions, in order to complete data processing tasks more.

Program Io Mode

The processor uses the program Io mode, that is, the "busy-waiting" mode. When the processor sends an IO command to the Controller to start the input data of the input device, set the idle sign in the Status Register to 1 at the same time. then the test continues until the flag is 0.

When the flag is 1, it indicates that the input machine has not completed one character;

When the flag is 0, it indicates that the input data has been sent to the data register of the controller.

In this way, the CPU is busy for most of the time due to the high speed of the CPU and the low speed of the IO Device. This causes a great waste of CPU resources.

If the input of a character is complete, the IO Device reports to the CPU, so that the CPU is not busy, so the interrupt processing method is generated.

Interrupt driver I/O Control Mode

That is, when a process starts an IO Device, the CPU sends an IO command to the corresponding device controller, and then immediately returns to continue executing the original task. The device controller then controls the specified Io device as required by the command. In this case, the CPU and I/O devices operate in parallel. Once the data enters the data register, the controller sends a one-stop message to the CPU through the control line. The CPU checks whether there is any error in the input process. If there is no error, it sends a signal to the Controller to remove the data, then, data is written to a specified memory unit through the Controller and data cable.

Direct Memory Access DMA Io Control Mode

Although interrupt-driven I/O is more effective than program I/O, it is noted that it is still in the unit of words (segments) for I/O. When I/O of a word (segment) is completed, the controller requests an interruption from the CPU. When I/O interrupt is used, the CPU is intervened in units of words (segments. If this method is used in block device Io, it is obviously extremely inefficient. Direct Memory Access is introduced to further reduce CPU Io intervention.

Features of this method:

    1. The basic unit of data transmission is data blocks.
    2. The transmitted data is directly sent to the memory from the device, or vice versa.
    3. CPU intervention is required only when one or more data blocks are transmitted, and the entire data block is transmitted under the control of the controller.

It can be seen that the DMA method is a hundred times less than the interrupt driver method, which further improves the parallel operation between the CPU and the IO Device.

 

The DMA controller consists of three parts:

L host and DMA controller Interfaces

L interface between the DMA controller and block Device

L Io control logic

Four types of registers:

L command status register: used to receive Io commands sent from the CPU, control information, or device status

L memory address register Mar. During input, it stores data from the device's initial destination address. During output, it stores the source address from memory to the device's memory.

L data register Dr: used to store data from the device to the memory or from the memory to the device.

L data counter DC: Number of words (segments) to be read or written by the CPU.

Io channel control mode

Although DMA can read one block at a time, when we want to read multiple blocks, it still needs to be interrupted multiple times.

The I/O channel is the development of the DMA mode, which can further reduce CPU intervention, that is, the intervention of reading and writing a data block as a unit, it is reduced to read and write data blocks and related control and management units. This improves the resource utilization of the entire system.

When the CPU needs to complete a set of related read/write operations and related control, it only needs to send an IO command to the IO channel, to give the first address of the channel program to be executed and the IO Device to be accessed. After the channel receives this command, it can complete the IO task specified by the CPU by executing the channel program.

An IO channel is a special processor that can execute Io commands and control Io operations by executing a channel program. However, Io channels are different from general processors, mainly manifested in:

The command type is single, mainly Io commands.

The channel does not have its own memory. The channel Program executed is stored in the host memory, that is, the IO channel shares the memory with the CPU.

Device independence

To improve the adaptability and scalability of the operating system, device independence is adopted in modern operating systems, that is, device independence. The basic meaning is that an application is independent of a specific physical device. Logical devices and physical devices are introduced to realize device independence. In an application, a logical device name is used to request a certain type of device. In actual execution, the system must also use the physical device name. Therefore, the system must also have the function of converting a logical device name to a physical device name. This isLogical Device table.

Benefits of device independence

L flexibility in device allocation: When an application requests to use a device with the name of a physical device, if the device has been assigned to another device or is under repair, however, although several other devices are idle, the process is still blocked. If you use a logical name for the request, you can allocate another device to it.

L easy Io redirection: devices used for Io operations can be replaced without changing the application. If the output of a program is a screen, but now you want to output the program to a file, you only need to change the data structure of Io redirection, that is, the display terminal in the logical device table to a file.

Device Independent Software

The driver is a software closely related to the hardware address. To achieve device independence, you must add a software layer to the driver, which is called the device independence software. Specific operations include:

L independent device allocation and recovery

L map the logical device name to the physical device name to further find the driver for the corresponding physical device

L protects devices and prohibits users from accessing devices directly.

L Buffer Management

L Error Control

L provides unified interfaces to user-layer software, such as read and write

How to map logical device names to physical device names

Logical Device table

 

 

Spooling technology

With Spooling technology, you can Virtualize a physical IO Device into multiple logical Io devices, and allow multiple users to share one physical IO Device.

Offline input and offline output are introduced to ease the conflict between high-speed CPU and low-speed IO devices. This technology uses a dedicated peripheral controller to transmit data from low-speed I/O devices to high-speed disks. In fact, when the system introduces multi-channel program technology, you can use one of the programs to simulate the peripheral control machine function for offline input, transmit the data on the low-speed IO Device to the high-speed disk. Then, use another program to simulate the function of the peripheral control machine when the plane is output, and transfer the data from the disk to the low-speed output device. In this way, the offline input and output functions can be implemented under the direct control of the host. In this case, the peripheral operation is performed simultaneously with the CPU processing of data. We call the external operation spooling or a fake offline operation when it is online.

Composition of the spooling System

 

Input and Output Wells

InDiskThe two storage spaces opened up on.

L The input well is a disk device used to simulate offline input. It is used to store input data of Io devices;

L The output well is a disk used to simulate offline output. It is used to store output programs of user programs.

Input buffer and output buffer

In order to ease the conflict between the speed mismatch between the CPU and diskMemoryTo open up two buffers:

L input buffer: temporarily store the data sent by the input device and then transmit the data to the input well.

L output buffer zone: stores Good and Evil data from the output well and sends it to the output device later.

Shared printer

When a user's process request is printed, the spooling system agrees to print the output for it, but does not actually assign the printer to the user's process immediately, but only do two things for it:

1) the output process applies for an idle disk zone for it in the output well and sends the data to be printed.

2) the output process then applies for a blank user request print table for the user process, fills in the user's print requirements, and then mounts the table to the request printer queue. If there are other processes that require output printing, the system can still accept the request.

3) if the printer is idle, the output process will retrieve a request print table from the first queue of the Request print queue and print the data according to the requirements in the table, the output well is transmitted to the memory cache and printed by the printer. After printing, the output process then checks whether a printed request table exists in the request print queue.

Features of the spooling System

L improves Io speed

L transforming an exclusive device into a shared device. In this system, no device is actually allocated for any process, instead, allocate a storage and create an IO request table for the process in the input or output wells. In this way, the exclusive device is transformed into a shared device.

L implements the virtual device function. In a macro sense, although multiple processes use an exclusive device at the same time, they will think that they own a device exclusively. Of course, this device is only a logical device. The spooling system converts exclusive devices into several logical devices.

Disk scheduling

A disk is a device that can be shared by multiple processes. When multiple processes require access to the disk, an optimal scheduling method should be used.AlgorithmTo minimize the average access time of each process.

First, we should first serve the FCFS shortest time first scanning algorithm

When the shortest track time is used, it will cause "Hunger", because as long as requests from new processes are continuously sent and the track to be accessed is close to the current track of the head, IO requests of such new processes must be satisfied first. Scanning algorithms can be avoided.

This method is also called the elevator scheduling algorithm.

In one direction, when moving to the other end, return.

Cyclic scanning algorithm

Problem solved: when the head just moved from the inside out and crossed a track, another process requests access to the track. At this time, the process must wait, the requests of the process are processed after the head continues from the inside out, and then scans all the tracks to be accessed from the outside, which greatly delays the requests of the process. To reduce this latency, the cyclic scan algorithm requires one-way head movement.

Low-cost Redundant Array raid

A disk array controller is used to centrally manage and control a set of disk drives to form a highly reliable and fast large-capacity disk system.

Parallel cross-Access

The system divides the data in each disk into several sub-disks, and then stores the data in each sub-disk block to the same location in different disks. In the future, when you want to transmit data from a disk block to the memory, use parallel transmission to transmit data from the sub-disk blocks to the memory at the same time, this greatly reduces the transmission time.

Raid advantages:

L High Reliability

L High Disk Io speed

L high performance and price

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.