操作系统大内核和微内核_操作系统中的内核I / O子系统
操作系統大內核和微內核
內核輸入/輸出子系統 (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
操作系統大內核和微內核
總結
以上是生活随笔為你收集整理的操作系统大内核和微内核_操作系统中的内核I / O子系统的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SpringCloud Nacos +
- 下一篇: 字节二面:优化 HTTPS 的手段,你知