From owner-freebsd-hackers Thu May 15 05:09:53 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id FAA15192 for hackers-outgoing; Thu, 15 May 1997 05:09:53 -0700 (PDT) Received: from punt-1.mail.demon.net (relay-7.mail.demon.net [194.217.242.9]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id FAA15186 for ; Thu, 15 May 1997 05:09:51 -0700 (PDT) Received: from wgold.demon.co.uk ([158.152.96.124]) by punt-1.mail.demon.net id aa0607473; 15 May 97 10:34 BST Received: from wgold.demon.co.uk by wgold.demon.co.uk (NTMail 3.02.10) with ESMTP id xa001427 for ; Thu, 15 May 1997 10:36:50 +0100 Message-ID: <337AD932.B69@westongold.com> Date: Thu, 15 May 1997 10:36:50 +0100 From: James Mansion Organization: Westongold Ltd X-Mailer: Mozilla 3.01Gold (WinNT; I) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: mmap() References: <199705121841.LAA07971@phaeton.artisoft.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Info: Westongold Ltd: +44 1992 620025 www.westongold.com Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Is this 'because of the way it happens to be implemented' or something fundamental? Is there any way that one could add a hint to say that the access will be sequential, or that it should fault in multiple pages? Some extra flags as an extension? Ideally one might try to keep a simple history and spot sequential access after a couple of pages are faulted in, and set the option automatically. James Terry Lambert wrote: > > > this question must be old, but anyway... > > > > why mmap() under freebsd (at least, 2.1) almost two times slower than > > read()? I've tryed to read large files, with multiple mmap()'ing file into > > buffer with size = getpagesize() * 10, and with/without madvise()... > > Because of the way buffering is implemented, mmap() can not trigger > predictive read-ahead, while read() can. The performance improvement > in read() for sequential I/O comes from read-ahead. > > Regards, > Terry Lambert > terry@lambert.org > --- > Any opinions in this posting are my own and not those of my present > or previous employers. -- Westongold Ltd C++/Java Multithread development and libraries +44 1920 444284 info@westongold.com