5.3.8 Special Properties of Disk Devices
A disk device has a special role to play in a virtual memory system. In order to realize virtual memory, the OS must call the disk driver for transferring data between memory and disk.
The need for the OS to perform data transfer with a disk arises when access is made to nonresident memory and the memory contents must be read from the disk (page in). The OS calls the disk driver in this case.
If nonresident memory is accessed in the disk driver, the OS must likewise call the disk driver. In such a case, if the disk driver treats the access to nonresident memory as a wait for page in, it is possible that the OS will again request disk access. Even then, the disk driver must be able to execute the later OS request.
A similar case may arise in suspension processing. When access is made to nonresident memory during suspension processing and a disk driver is called, if that disk driver is already suspended, page in will not be possible. To avoid such a situation, suspension processing should suspend other devices before disk devices. If there are multiple disk devices, however, the order of their suspension is indeterminate. For this reason, during suspension processing a disk driver must not access nonresident memory.
Because of the above limitations, a disk driver must not use (access) nonresident memory. It is possible, however, that the IO bu.er (buf) space specified with tk_rea_dev or tk_wri_dev will be nonresident memory, since this is a memory location specified by the caller. In the case of IO bu.ers, therefore, it is necessary to make the memory space resident (see LockSpace) at the time of IO access.

Comments