Path: utzoo!mnetor!uunet!husc6!think!ames!aurora!labrea!decwrl!ucbvax!LBL.GOV!nagy%warner.hepnet From: nagy%warner.hepnet@LBL.GOV (Frank J. Nagy, VAX Wizard & Guru) Newsgroups: comp.os.vms Subject: RE: Buffered vs. direct I/O's Message-ID: <880119060242.20e00e4f@LBL.Gov> Date: 19 Jan 88 14:02:42 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 52 First, the difference between buffered and direct I/Os is determined by the device driver. Devices which can do direct I/O (disks, array processors, image processors, tapes, etc.) do their DMA directly to or from buffers in the user's virtual memory space. Buffered devices (terminals, some network operations, etc.) use buffers allocated in system space in nonpaged pool. In earlier versions of VMS the difference reflected that between DMA devices and programmed I/O devices (usually the DZ11 terminal controllers). So to summarize the differences are concerned with data transfers to/from the buffers in the user process's virtual address space: direct I/O devices transfer data directly to/from the user buffers by locking those buffers into memory, double-mapping them into system address space (to allow non-process context reference by the device driver) and initiating DMA operations between these buffers and the device. buffered I/O devices transfer data between the user buffers and system buffers in nonpaged pool. The device driver then uses either DMA (new terminal controllers, network interfaces) or programmed I/O to move data between the system buffers and the device. > In terms of CPU and other resource usage, I would like to know which of these > is more expensive and precisely why. Buffered I/O can be more expensive in CPU time (extra memory move) but the amount of data transferred in each operation is usually fairly small for buffered I/O. Depending upon the device (such as DZ11s), programmed I/O between the system buffers and the device can use *lots* of CPU time (i.e. DZ11 causes lots of interrupt processing). Buffered I/O uses system memory resources (nonpaged pool). Direct I/O requires CPU overhead to setup (map the user buffers into system space, lock buffers into memory, setup bus adapter maps for the Unibus or QBus) but then the DMA operation does not require the CPU. Typically direct I/O is used for DMA devices and large operations (disks and tapes). Note that disk I/O still uses direct I/O even with RMS. The RMS buffers the direct I/O is to/from are in the process's virtual address space. So, RMS buffering does not count as buffered I/O per se. RMS buffering allows lots of record operations to be done to/from the RMS buffers and then direct I/O to/from the disks in large chunks as set by the RMS buffer size and multibuffer count parameters. = Frank J. Nagy "VAX Guru & Wizard" = Fermilab Research Division EED/Controls = HEPNET: WARNER::NAGY (43198::NAGY) or FNAL::NAGY (43009::NAGY) = BitNet: NAGY@FNAL = USnail: Fermilab POB 500 MS/220 Batavia, IL 60510