WILSON%M_DSN%M_MAILNOW@sdr.slb.COM ("Brad Wilson, DS-TUR, 250-4393", 918) (01/19/88)
In partial answer to Ruth Milner's question about buffered I/O versus direct I/O: Buffered I/O is generally used for slower devices. When a user makes a buffered I/O request, a buffer is created in non-paged pool. This buffer is the same size as the buffer specified by the user in his/her process space. If it is an output operation, the user's data are copied into the buffer and the driver then transfers data from the buffer to the device. On an input operation, the driver transfers data to the buffer until the I/O terminates at which time these data are copied to the original buffer in the user's space. The method used by the driver to transfer data to/from the device is irrelevant. The size of the buffer in non-paged pool is deducted from the user's remaining BYTLM quota, and is returned when the I/O completes and the buffer is released back into the pool. Because the data transfers are to/from system space (non-paged pool), a process waiting for a buffered I/O operation may be swapped out of memory. It is this property that makes buffered I/O preferable for slower or character-oriented devices (such as terminals). Direct I/O involves data transfer directly (more or less) into the user's buffer. Some drivers may actually use a buffer in non-paged pool as a work area. This buffer is fixed in size (usually 512 bytes) and is independent of the size of the transfer requested. No modification of the user's BYTLM quota is made for direct I/O. Because the data are transfered directly from/into the user's process space, the process is not swappable when there is an outstanding direct I/O request. Drivers specify in their function decision table which operations are buffered and which are direct. In many cases, buffered I/O operations do not actually transfer data, but merely set characteristics or environments for subsequent operations. A quick look at PDDRIVER (pseudo-disk driver) indicates that all operations except actual reading and writing are listed as buffered for this device. The buffered operations include MOUNT, ACCESS (find file), SENSECHAR, ACPCONTROL, etc. Since buffered I/O operations often do not actually transfer data and direct I/O operations may actually use a fixed-size buffer, I don't think it's possible to determine that one type is "more expensive" than another. I hope this helps. If I got anything wrong in the above, please feel free to correct me. Brad Wilson Dowell Schlumberger Tulsa, OK