Subject: Re: cp(1) vs. UVM/UBC
To: Matthias Buelow <firstname.lastname@example.org>
From: Andy Isaacson <email@example.com>
Date: 07/21/2001 14:27:26
On Sat, Jul 21, 2001 at 06:21:04PM +0200, Matthias Buelow wrote:
> Matthias Scheler writes:
> >He is talking about smart userland code. "cp" e.g. would simply use the
> >old read(2) loop in this case.
> Does mmapping a file for copying instead of simply reading it really
> pay off that much that it justifies complicating a silly little command
> like cp, and a long thread here? I would've thought that in a near
> 100% of all situations, cp was i/o (read: disk/network) bound, and the
> extra kernel->userland copy was totally insignificant.
Well, sometimes this redesign can provide significant benefit in
degenerate cases. For example, Solaris /bin/cp does the mmap/write
trick (with a madvise in there too), and if you /bin/cp a file to
/dev/null, it doesn't even bother to fault in the pages. For example, I
can cp /some/nfs/directory/100mb_file /dev/null in
on a SunOS snow 5.8 Generic_108528-06 sun4u sparc SUNW,Ultra-4 machine.
(The file was newly created on the NFS server immediately before that
'cp' command, so there's no cacheing going on.)