Re: OFFTOPIC: Regarding NT vs Linux

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Tue, 23 Sep 1997 09:25:10 +0200 (MET DST)


Michael Nelson wrote:
>
> On Mon, 22 Sep 1997, Marc Singer wrote:
>
> > > There are also some kewl things like TransmitFile where you can send a
> > > data stream out of a socket without having to copy the data in chunks to
> > > and from user-space.
> > >
> > > Sure, Linux could have this.... but it would it be useful if no other unix
> > > had this.
> >
> > Linux does have this and it is better than the NT implementaion. If
> > you mmap the file, the kernel doesn't need to copy before sending it
> > over the wire. There was a thread on this list about it.
>
> Huh? I thought the conclusion of that thread was that the mmap method
> incurred significant overhead because it was only page faulting one page
> at a time.

Depends on what the workload of your machine is. If you're short on CPU
and have lots of IO bandwidth available the one page at a time method
will be preferrable.

On the other hand,

p = mmap (fd, ..., file_size);
for (i=0;i < file_size;i+= PAGE_SIZE);
(void) *(volatile char *)p[i]; /* Generate a ref to p[i] */

write (socket, p, file_size);

will first pagefault as fast as possible, allowing the drive to get
all pages in one go, and then write the data from memory.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** +31-15-2137555 ** http://www.BitWizard.nl/ **
Florida -- A 39 year old construction worker woke up this morning when a
109-car freigt train drove over him. According to the police the man was 
drunk. The man himself claims he slipped while walking the dog. 080897