Ngoài ra, nếu các khối nguồn và điểm đến chồng chéo, khối nguồn có thể được sửa đổi, trong trường hợp này chúng ta có thể không chỉ đơn giản là khởi động lại hướng dẫn. Vấn đề này có thể được giải quyết theo hai cách khác nhau. Trong một giải pháp, | Kernel Subsystem 511 kernei user ọ f requesting process wasting device driver inrenupt handier data bp Ú Stet-44 . time a i cquesfi iq process teer J device driver. r .------------------ -- j J i I interrupt handler ị V I hardware i-ll claỉa transfef----- - kernel Figure Two I O methods a synchronous and b asynchronous. selecto must be followed by some kind of readO or writeo command. A variation on this approach found in Mach is a blocking multiple-read call. It specifies desired reads for several devices in one system call and returns as soon as any one of them completes. Kernel I O Subsystem Kernels provide many services related to I O. Several services scheduling buffering caching spooling device reservation and error handling are provided by the kernel s I O subsystem and build on the hardware and devicedriver infrastructure. The I O subsystem is also responsible for protecting itself from errant processes and malicious users. I O Scheduling To schedule a set of I O requests means to determine a good order in which to execute them. The order in which applications issue system calls rarely is the best choice. Scheduling can improve overall system performance can share device access fairly among processes and can reduce the average waiting time for I O to complete. Here is a simple example to illustrate the opportunity. Suppose that a disk arm is near the beginning of a disk and that three applications issue blocking read calls to that disk. Application 1 requests a block near the end of the disk application 2 requests one near the beginning and application 3 requests one in the middle of the disk. The operating system can reduce the distance that the disk arm travels by serving the applications in the order 2 3 1. Rearranging the order of service in this way is the essence of I O scheduling. Operating-system developers implement scheduling by maintaining a wait queue of requests for each device. When an application issues a blocking I O .