From owner-freebsd-hackers Sat Apr 22 10:23:50 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.nyct.net (bsd4.nyct.net [204.141.86.6]) by hub.freebsd.org (Postfix) with ESMTP id C1DE337B568 for ; Sat, 22 Apr 2000 10:23:47 -0700 (PDT) (envelope-from mbac@nyct.net) Received: from bsd1.nyct.net (root@bsd1.nyct.net [204.141.86.3]) by mail.nyct.net (8.9.3/8.8.7) with ESMTP id NAA39073; Sat, 22 Apr 2000 13:25:12 -0400 (EDT) (envelope-from mbac@nyct.net) Received: from localhost (mbac@localhost) by bsd1.nyct.net (8.9.3/8.9.3) with ESMTP id NAA38646; Sat, 22 Apr 2000 13:23:41 -0400 (EDT) (envelope-from mbac@nyct.net) X-Authentication-Warning: bsd1.nyct.net: mbac owned process doing -bs Date: Sat, 22 Apr 2000 13:23:40 -0400 (EDT) From: Michael Bacarella To: Matthew Dillon Cc: Alfred Perlstein , Kevin Day , hackers@FreeBSD.ORG Subject: Re: Double buffered cp(1) In-Reply-To: <200004221706.KAA55294@apollo.backplane.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > :extend (using truncate) and then mmap() the destination file, then > :read() directly into the mmap()'d portion. > : > :I'd like to see what numbers you get. :) > read + write is a better way to do it. It is still possible to > double buffer. In this case simply create a small anonymous shared > mmap that fits in the L2 cache (like 128K), setup a pipe, fork, and > have one process read() from the source while the other write()s to the > destination. The added overhead is actually less then 'one buffer copy' > worth if the added buffering fits in the L1 or L2 cache. It seems silly to implement something as trivial and straightforward as copying a file in userland. The process designated to copy a file just sits in a tight loop invoking the read()/write() syscalls repeatedly. Since this operation is already system bound and very simple, what's the arguement against absorbing it into the kernel? -MB To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message