From owner-freebsd-questions Tue Jan 8 0:41:21 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mpehp1.mpe-garching.mpg.de (mpehp1.mpe-garching.mpg.de [130.183.70.10]) by hub.freebsd.org (Postfix) with ESMTP id 7C02537B400 for ; Tue, 8 Jan 2002 00:41:18 -0800 (PST) Received: from robert2.mpe-garching.mpg.de (robert2.mpe-garching.mpg.de [130.183.136.59]) by mpehp1.mpe-garching.mpg.de (8.8.6 (PHNE_17135)/8.8.6) with ESMTP id JAA26360 for ; Tue, 8 Jan 2002 09:41:17 +0100 (MET) Received: (from sutter@localhost) by robert2.mpe-garching.mpg.de (8.11.6/8.11.6) id g088foS02664 for freebsd-questions@freebsd.org; Tue, 8 Jan 2002 09:41:50 +0100 (CET) (envelope-from sutter) Date: Tue, 8 Jan 2002 09:41:50 +0100 From: Robert Suetterlin To: freebsd-questions@freebsd.org Subject: Q: mmap+ftruncate or write for large linear writes? Message-ID: <20020108084150.GA2582@robert2.mpe-garching.mpg.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.24i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi! I currently rewrite a data aquiaition program of ours. It does some 60MByte/sec, currently using write(2). Data is stored in a ringbuffer by data aquisition hardware. I am currently reconsidering which commands to use to do the transfer of data to file. I looked at writev, aio_write and mmap+ftruncate. mmap+ftruncate sounds quite promising, but mmap specifically discurrages using it for large linear writes on ftruncated files. It recommends to fill the file with zeros before mmaping. But ftruncate's man page specifically states it would grow the file 'as if filled with zeros'. I guess this just refers to what You get if You'd read the ftruncated file. What would be Your recommendation on this task. BTW there is no hidden information or special trick here, I just have to write 60MByte/sec and write(2) can do the job. I just wanted to make up my mind on the topic. Regards, Robert S. -- Robert Suetterlin (robert@mpe.mpg.de) phone: (+49)89 / 30000-3546 fax: (+49)89 / 30000-3950 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message