Boost logo

Boost :

From: Iain K. Hanson (iain.hanson_at_[hidden])
Date: 2005-05-04 08:46:05


On Tue, 2005-05-03 at 20:55 -0700, Nathan Myers wrote:
> On Wed, May 04, 2005 at 09:07:24AM +1200, Scott Woods wrote:
> > From: "Nathan Myers" <ncm_at_[hidden]>
> >

> (Another goal is a zero-copy streambuf whose buffer is an mmap page
> that can be read into or written from without actually copying any
> bytes from kernel to user space, or back.

That would be impressive! Unfortunately I don't think it is
theoretically possible ;-). Under normal conditions the interface
device driver copies from the hardware device buffer to kernel space.
The data passes up the stack until it is copied from kernel space to
user space for a total of 2 copies. you would also get two copies on the
other side ( mmap ). It is certainly possible to eliminate one copy on
each side.

> I half get the impression
> somebody is working on something like this already. On NetBSD or
> OpenBSD, BTW, you can do zero-copy pipe and socket I/O that way, too
> -- so sendfile() is just a library function. I don't know if Linux
> will ever get that.)
>
I believe Doug Schmidt has done something on this but just on sockets.
IIRC it involved writing his own device drive and use on Data Link Layer
access to sockets to copy directly from the hardware buffer to user
space. The down side of this is you now need your IP stack also in user
space.

/ikh

_______________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security System.
_______________________________________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk