操作系统大内核和微内核
内核输入/输出子系统 (Kernel Input / Output subsystem)
Input and output (I/O) devices permit us to communicate with the computer system. I/O is the transfer of data between RAM and various I/O peripherals. By using Input devices such as keyboards, mouse, card readers, scanners, voice recognition systems, and touch screens we can enter data into the computer. y using output devices such as monitors, printers, plotters, and speakers allow us to get information from the computer.
输入和输出(I / O)设备允许我们与计算机系统进行通信。 I / O是RAM和各种I / O外设之间的数据传输。 通过使用输入设备,例如键盘,鼠标,读卡器,扫描仪,语音识别系统和触摸屏,我们可以将数据输入计算机。 使用显示器,打印机,绘图仪和扬声器之类的输出设备可以使我们从计算机中获取信息。
These devices directly not connected with the CPU. But there is an interface that manages the data transfers between them. The system bus signals converted to and from a format that is acceptable to the given device by this interface. Communication between these external devices and processor is done via I/O registers.
这些设备直接未与CPU连接。 但是有一个接口可以管理它们之间的数据传输。 系统总线通过此接口将信号转换为给定设备可以接受的格式,或从该设备接受该格式。 这些外部设备和处理器之间的通信通过I / O寄存器完成。
The kernel provides many services related to I/O. Several services such as scheduling, caching, spooling, device reservation, and error handling – are provided by the kernel, and build on the hardware and device driver infrastructure.
内核提供了许多与I / O相关的服务。 内核提供了一些服务,例如调度,缓存,后台处理,设备保留和错误处理,这些服务建立在硬件和设备驱动程序基础结构上。
We will discuss kernel services such as I/O scheduling, Caching, Buffering, Spooling, Device Reservation, I/O Protection, and Error Handling.
我们将讨论内核服务,例如I / O调度,缓存,缓冲,假脱机,设备保留,I / O保护和错误处理。
1)排程 (1) Scheduling)
It means to determine a good order in which to execute input/output requests called disk scheduling.
这意味着确定执行输入/输出请求的良好顺序,称为磁盘调度。
Scheduling I/O requests can greatly improve overall efficiency. Priorities can also play a vital role in request scheduling and can reduce the average waiting time for I/O to complete.
安排I / O请求可以大大提高整体效率。 优先级还可以在请求调度中发挥至关重要的作用,并且可以减少I / O完成的平均等待时间。
By this device access, permissions will be fair to all jobs. When an application issues a blocking I/O system call, the request is placed on the job queue for that device. The order of the queue rearranges by the Kernel I/O scheduler to improve the overall system efficiency.
通过此设备访问,权限将对所有作业均公平。 当应用程序发出阻塞的I / O系统调用时,该请求将放置在该设备的作业队列上。 队列的顺序由内核I / O调度程序重新排列,以提高整体系统效率。
2)缓存 (2) Caching)
It involves keeping a copy of data in a faster access location than where the data is normally stored.
它涉及将数据副本保存在比通常存储数据的位置更快的访问位置。
For example, when you request a file by looking at a Web page are stored on your hard disk in a cache subdirectory under the directory for your browser. When you get back to a page you have recently visited, the browser can get those files from the cache rather than the original server, saving you time and saving the network the burden of additional traffic.
例如,当您通过查看网页来请求文件时,网页存储在您的硬盘上浏览器目录下的缓存子目录中。 当您返回到您最近访问过的页面时,浏览器可以从缓存而不是原始服务器中获取这些文件,从而节省了时间并减轻了网络额外流量的负担。
There is a difference between cache and buffer is cache is a duplicate copy of some other data stored elsewhere whereas buffer stores copy of an existing data item.
高速缓存与缓冲区之间的区别在于,高速缓存是存储在其他位置的某些其他数据的副本,而缓冲区则存储现有数据项的副本。
3)缓冲 (3) Buffering)
Buffer is a memory area maintains by Kernel I/O Subsystem that stores data while they are transferred between two devices or between a device with an application.
缓冲区是由内核I / O子系统维护的存储区,用于在两个设备之间或带有应用程序的设备之间传输数据时存储数据。
Buffering is done for three reasons.
进行缓冲有三个原因。
One reason is to adapt to devices that have different data transfer sizes.
原因之一是要适应具有不同数据传输大小的设备。
A second use of buffering is to support copy semantics for an application I/O. An application wants to write data on disk which is stored in its buffer, it is called “copy semantic ”. it calls the write() system call, providing a pointer to the buffer and the integer specify the number of bytes to write.
缓冲的第二个用途是支持应用程序I / O的复制语义。 一个应用程序想要在磁盘上写入存储在其缓冲区中的数据,这被称为“复制语义”。 它调用write()系统调用,提供指向缓冲区的指针,整数指定要写入的字节数。
A third one is to cope with the speed mismatch between the producer and consumer of the data stream.
第三个是应付数据流的生产者和消费者之间的速度不匹配。
4)假脱机 (4) Spooling)
A spool is a type of buffer that holds output for a device. It is the process in which jobs from the cards are read directly onto the disk and the location of that card in the disk is recorded in a table by the operating system. When that job is required for execution, it is read from the disk.
假脱机是一种缓冲区,用于保存设备的输出。 在此过程中,卡中的作业被直接读取到磁盘上,操作系统将该卡在磁盘中的位置记录在表中。 当需要执行该作业时,将从磁盘读取该作业。
For example, several applications may wish to print their output concurrently, so spooling solves this problem by maintaining a queue for the output. A printer does not accept interleaved data. The output of all application is spooled in a separate disk file. When an application finishes printing then the spooling system queues the corresponding spool file for output to the printer.
例如,几个应用程序可能希望同时打印其输出,因此假脱机通过为输出保留队列来解决此问题。 打印机不接受交错数据。 所有应用程序的输出都后台处理在单独的磁盘文件中。 当应用程序完成打印时,假脱机系统会将相应的假脱机文件排队,以输出到打印机。
5)设备预约 (5) Device Reservation)
It provides exclusive device access. Allocation of devices when required by the processes and that device when it is no longer needed. It prevents deadlock. Many operating systems provide features that enable processes to coordinate and give exclusive access to them.
它提供独占的设备访问权限。 在流程需要时分配设备,在不再需要时分配设备。 它可以防止死锁。 许多操作系统提供的功能使进程能够进行协调并为其提供独占访问权。
6)I / O保护 (6) I/O Protection)
I/O must be performed via system calls. User processes may accidentally or purposefully attempt to disrupt normal operation via illegal I/O instructions. To prevent a user from do all I/O instructions defined to be privileged.
I / O必须通过系统调用执行。 用户进程可能会通过非法的I / O指令意外或有意地破坏正常操作。 为了防止用户执行所有定义为特权的I / O指令。
7)错误处理 (7) Error Handling)
An operating system that uses protected memory that can guard against many kinds of hardware and application errors. Devices and I/O transfers may fail in some manner, either for transient reasons, as when a network becomes overloaded or for permanent reasons, as when a disk controller becomes defective.
一个使用受保护的内存的操作系统,可以防止多种硬件和应用程序错误。 设备和I / O传输可能会以某种方式失败,可能是由于暂时原因(例如网络过载时),也可能是由于永久性原因(例如磁盘控制器出现故障)。
翻译自: https://www.includehelp.com/operating-systems/kernel-io-subsystem.aspx
操作系统大内核和微内核